:root {
  --navy: #071a34;
  --navy-2: #0d2a4b;
  --cyan: #08bde8;
  --cyan-dark: #078dab;
  --ink: #14273e;
  --muted: #718197;
  --line: #dce5ec;
  --soft: #f3f7f9;
  --white: #fff;
  --green: #15976f;
  --amber: #c7780b;
  --red: #c24242;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--soft); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -1px;
}
.brand em { color: var(--cyan); font-style: normal; }
.brand-mark {
  position: relative;
  width: 27px;
  height: 27px;
  display: inline-block;
  transform: rotate(-45deg);
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 11px;
  height: 23px;
  border: 4px solid var(--cyan);
  border-radius: 999px;
}
.brand-mark::before { left: 2px; }
.brand-mark::after { right: 2px; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 42%) 1fr;
  background: white;
}
.login-panel {
  padding: clamp(36px, 7vw, 90px);
  display: flex;
  flex-direction: column;
}
.login-card { width: min(430px, 100%); margin: auto; }
.login-card .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan-dark);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.2px;
  font-weight: 750;
}
.login-card .eyebrow::before { content: ""; width: 24px; height: 2px; background: var(--cyan); }
.login-card h1 { margin: 18px 0 10px; font-size: 38px; letter-spacing: -1.7px; color: var(--navy); }
.login-card > p { margin: 0 0 34px; color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label { font-size: 12px; font-weight: 700; color: #43566d; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #cfdbe4;
  border-radius: 8px;
  background: white;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
}
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(8, 189, 232, .13);
}
.primary-button {
  border: 0;
  border-radius: 8px;
  min-height: 46px;
  padding: 0 18px;
  background: var(--cyan);
  color: var(--navy);
  font-weight: 800;
}
.primary-button:hover { background: #23c8ed; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.login-submit { width: 100%; margin-top: 4px; }
.form-error {
  color: var(--red);
  background: #fff0f0;
  border: 1px solid #f0caca;
  border-radius: 7px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
}
.login-help { margin-top: 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.webphone-link {
  display: flex;
  min-height: 46px;
  margin-top: 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}
.webphone-link:hover { border-color: var(--cyan); background: #f3fcfe; }
.login-aside {
  background:
    radial-gradient(circle at 85% 15%, rgba(8, 189, 232, .25), transparent 32%),
    linear-gradient(145deg, #06172e, #0a2b4b);
  color: white;
  display: flex;
  align-items: center;
  padding: clamp(46px, 8vw, 110px);
}
.login-aside-inner { max-width: 600px; }
.login-aside .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  padding: 8px 12px;
  border-radius: 999px;
  color: #bceeff;
  font-size: 11px;
}
.login-aside .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #42d69d; }
.login-aside h2 { font-size: clamp(38px, 5vw, 65px); line-height: 1.03; letter-spacing: -3px; margin: 27px 0 22px; }
.login-aside p { max-width: 520px; color: #b5c4d4; font-size: 17px; line-height: 1.7; }
.login-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 40px; }
.login-points div { border-top: 1px solid rgba(255,255,255,.18); padding-top: 15px; }
.login-points b { display: block; color: white; font-size: 13px; }
.login-points span { color: #8fa5ba; font-size: 11px; }

/* Application */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 245px;
  background: var(--navy);
  color: #a9b8c8;
  padding: 25px 17px 18px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { color: white; padding: 0 10px; }
.workspace {
  margin: 28px 0 23px;
  border: 1px solid #25415f;
  background: #102b4b;
  border-radius: 9px;
  padding: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.workspace-icon {
  width: 34px; height: 34px; border-radius: 7px;
  display: grid; place-items: center; background: var(--cyan); color: var(--navy); font-size: 11px; font-weight: 900;
}
.workspace div { display: grid; gap: 3px; }
.workspace b { color: white; font-size: 11px; }
.workspace small { font-size: 9px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link {
  border: 0; background: transparent; color: inherit; text-align: left;
  height: 43px; border-radius: 7px; padding: 0 12px;
  display: flex; align-items: center; gap: 13px; font-size: 12px;
}
.nav-link:hover, .nav-link.active { background: #123553; color: white; }
.nav-link.active { box-shadow: inset 2px 0 var(--cyan); }
.nav-icon { width: 18px; color: #7f96ab; text-align: center; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #243b55; padding-top: 14px; }
.user-card { display: flex; align-items: center; gap: 9px; padding: 10px; background: #0d2744; border-radius: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #254a6c; color: white; font-size: 10px; }
.user-card div { display: grid; gap: 3px; min-width: 0; }
.user-card b { color: white; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.user-card small { font-size: 9px; }
.logout-button { width: 100%; margin-top: 9px; border: 0; background: transparent; color: #94a8bb; font-size: 11px; padding: 8px; }
.app-main { width: calc(100% - 245px); margin-left: 245px; }
.topbar {
  height: 69px; background: white; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 31px; position: sticky; top: 0; z-index: 5;
}
.search-box { width: 340px; height: 37px; border: 1px solid var(--line); border-radius: 7px; color: #8997a6; display: flex; align-items: center; padding: 0 12px; font-size: 11px; }
.system-state { display: flex; align-items: center; gap: 8px; color: #607086; font-size: 11px; }
.system-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.page { padding: 31px; max-width: 1500px; margin: auto; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 25px; }
.page-head .kicker { text-transform: uppercase; letter-spacing: 1.1px; font-size: 10px; color: #7a899b; }
.page-head h1 { color: var(--navy); margin: 6px 0; font-size: 29px; letter-spacing: -1.2px; }
.page-head p { color: var(--muted); margin: 0; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 16px; }
.card { background: white; border: 1px solid var(--line); border-radius: 10px; }
.stat { padding: 18px; }
.stat span, .stat strong, .stat small { display: block; }
.stat span { color: #6d7d91; font-size: 11px; }
.stat strong { color: var(--navy); font-size: 27px; letter-spacing: -1px; margin: 10px 0 6px; }
.stat small { color: var(--green); font-size: 10px; }
.panel { padding: 20px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 15px; color: var(--navy); margin: 0 0 4px; }
.panel-head p { color: #8795a5; font-size: 10px; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; color: #8b98a7; font-size: 9px; letter-spacing: .4px; padding: 10px; border-bottom: 1px solid #edf1f4; }
td { padding: 13px 10px; border-bottom: 1px solid #edf1f4; font-size: 11px; color: #52657a; }
td b { color: #24384f; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; background: #e9f7f2; color: var(--green); font-size: 9px; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.secondary-button, .table-action {
  border: 1px solid var(--line); background: white; color: #496078; border-radius: 7px; padding: 8px 11px; font-size: 10px; font-weight: 700;
}
.table-select {
  width: 100%;
  min-width: 155px;
  border: 1px solid var(--line);
  background: white;
  color: #435a72;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 10px;
}
.table-action { padding: 6px 8px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state b { display: block; color: var(--navy); margin-bottom: 7px; }
.loading { padding: 70px; text-align: center; color: var(--muted); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 18, 36, .55);
  display: grid; place-items: center; padding: 20px; z-index: 20;
}
.modal { width: min(540px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: white; border-radius: 13px; box-shadow: 0 30px 90px rgba(3,20,40,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; margin: 0; color: var(--navy); }
.modal-close { border: 0; background: #f0f4f6; width: 30px; height: 30px; border-radius: 50%; color: #617287; }
.modal form { padding: 22px; }
.modal-message { padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-note { color: var(--muted); font-size: 11px; line-height: 1.55; }
.credential-result h3 { color: var(--navy); font-size: 20px; margin: 18px 0 6px; }
.credential-result > p { color: var(--muted); font-size: 12px; }
.credential-result dl { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin: 20px 0; }
.credential-result dl div { display: grid; grid-template-columns: 110px 1fr; gap: 15px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.credential-result dl div:last-child { border-bottom: 0; }
.credential-result dt { color: var(--muted); font-size: 11px; }
.credential-result dd { margin: 0; color: var(--ink); font-size: 11px; overflow-wrap: anywhere; }
.credential-result code, td code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: #103b30; color: #d8fff0; padding: 13px 16px; border-radius: 8px; box-shadow: 0 15px 45px rgba(4,20,35,.2); z-index: 30; font-size: 12px; }
.toast.error { background: #652929; color: #ffe7e7; }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .sidebar { width: 205px; }
  .app-main { width: calc(100% - 205px); margin-left: 205px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 650px) {
  .login-panel { padding: 28px 22px; }
  .sidebar { display: none; }
  .app-main { width: 100%; margin: 0; }
  .topbar { padding: 0 16px; }
  .search-box { display: none; }
  .page { padding: 21px 14px; }
  .page-head { align-items: start; }
  .page-head h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
