:root {
  color-scheme: light;
  --navy: #10213f;
  --navy-soft: #50607a;
  --blue: #1196cf;
  --blue-dark: #087cae;
  --blue-pale: #eaf7fc;
  --purple: #6d55cc;
  --orange: #f48619;
  --green: #138866;
  --red: #bd3c4c;
  --canvas: #f3f6fa;
  --surface: #ffffff;
  --line: #e2e8f0;
  --muted: #738097;
  --shadow: 0 18px 45px rgba(32, 56, 85, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--navy);
  background: var(--canvas);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }

:focus-visible {
  outline: 3px solid rgba(17, 150, 207, .28);
  outline-offset: 2px;
}

.is-hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: clamp(36px, 7vw, 110px);
  align-items: center;
  padding: clamp(32px, 6vw, 90px);
  background:
    radial-gradient(circle at 12% 18%, rgba(17, 150, 207, .16), transparent 34%),
    radial-gradient(circle at 90% 78%, rgba(244, 134, 25, .13), transparent 35%),
    #f8fafc;
}

.login-intro { max-width: 680px; }
.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: white;
  font-size: 34px;
  font-weight: 800;
  background: linear-gradient(145deg, var(--blue), var(--purple));
  box-shadow: 0 16px 34px rgba(44, 102, 173, .26);
}

.eyebrow {
  margin: 22px 0 8px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
}

.login-intro h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 1.08;
  letter-spacing: -.04em;
}

.intro-copy {
  margin: 24px 0;
  max-width: 590px;
  color: var(--navy-soft);
  font-size: 20px;
  line-height: 1.75;
}

.security-points {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  color: var(--navy-soft);
  list-style: none;
}

.security-points li::before {
  content: "✓";
  margin-right: 10px;
  color: var(--green);
  font-weight: 900;
}

.login-card {
  width: 100%;
  max-width: 480px;
  justify-self: end;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 28px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.login-card .eyebrow { margin-top: 0; }
.login-card h2, .page-heading h2, .dialog-header h2 {
  margin: 0;
  font-size: 30px;
}

.muted { color: var(--muted); }

label {
  display: block;
  margin-bottom: 8px;
  color: var(--navy-soft);
  font-size: 14px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #ced7e3;
  border-radius: 12px;
  color: var(--navy);
  background: white;
}

.login-card input { margin-bottom: 20px; }

.primary-button, .secondary-button, .text-button, .icon-button, .nav-button {
  border: 0;
  border-radius: 12px;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 10px 22px rgba(17, 150, 207, .2);
}

.login-card .primary-button { width: 100%; margin-top: 4px; }
.secondary-button {
  min-height: 44px;
  padding: 0 18px;
  color: var(--navy);
  border: 1px solid var(--line);
  background: white;
  font-weight: 700;
}

.text-button { color: var(--navy-soft); background: transparent; padding: 8px 4px; }
.form-message { min-height: 22px; margin: 12px 0 0; color: var(--red); font-size: 14px; }
.form-message.is-success { color: var(--green); }
.help-text { margin: 22px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.app-shell { min-height: 100vh; }
.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: white;
}

.topbar-brand, .account-summary { display: flex; align-items: center; gap: 14px; }
.brand-mark-small { width: 50px; height: 50px; border-radius: 16px; font-size: 23px; }
.topbar .eyebrow { margin: 0 0 3px; }
.topbar h1 { margin: 0; font-size: 22px; }
.account-summary { text-align: right; }
.account-summary strong { display: block; }
.role-badge {
  display: inline-flex;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--purple);
  background: #f0edff;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  width: min(1500px, 100%);
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  margin: 0 auto;
  padding: 30px clamp(18px, 3vw, 44px) 70px;
}

.sidebar { display: flex; flex-direction: column; gap: 9px; }
.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--navy-soft);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-button span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--blue-dark);
  background: var(--blue-pale);
}

.nav-button.is-active { color: var(--navy); background: white; box-shadow: 0 8px 20px rgba(32, 56, 85, .07); }
.permission-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #dce9f2;
  border-radius: 18px;
  background: linear-gradient(150deg, #eff9fd, #f8f6ff);
}
.permission-card .eyebrow { margin: 0 0 8px; }
.permission-card p:last-child { margin-bottom: 0; font-size: 13px; line-height: 1.6; }

.content-area { min-width: 0; }
.page-panel {
  min-height: 600px;
  padding: clamp(22px, 3vw, 36px);
  border-radius: 24px;
  background: white;
  box-shadow: 0 12px 38px rgba(32, 56, 85, .07);
}
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-heading .eyebrow { margin-top: 0; }
.page-heading .muted { margin-bottom: 0; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(170px, .7fr) minmax(220px, 1fr) auto auto;
  gap: 14px;
  align-items: end;
  margin: 30px 0 22px;
  padding: 18px;
  border-radius: 16px;
  background: var(--canvas);
}
.filter-submit { box-shadow: none; }

.notice {
  margin: 14px 0;
  padding: 13px 16px;
  border-radius: 12px;
  color: var(--blue-dark);
  background: var(--blue-pale);
  font-size: 14px;
}
.notice.is-error { color: var(--red); background: #fff0f2; }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 830px; border-collapse: collapse; }
th, td { padding: 16px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--navy-soft); background: #f8fafc; font-size: 13px; white-space: nowrap; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.order-link { color: var(--blue-dark); border: 0; background: transparent; font-weight: 800; }
.status-chip {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  color: #53627b;
  background: #edf1f6;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-chip[data-tone="blue"] { color: var(--blue-dark); background: var(--blue-pale); }
.status-chip[data-tone="green"] { color: var(--green); background: #e8f7f1; }
.status-chip[data-tone="orange"] { color: #a05c14; background: #fff3e5; }
.status-chip[data-tone="red"] { color: var(--red); background: #fff0f2; }
.empty-state { padding: 55px 20px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--navy); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.detail-card { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.detail-card h3 { margin: 0 0 14px; }
dl { margin: 0; }
.detail-card dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid #eef2f6; }
.detail-card dl > div:last-child { border-bottom: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.account-grid { max-width: 980px; }

.order-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--navy);
  box-shadow: 0 30px 80px rgba(8, 27, 53, .25);
}
.order-dialog::backdrop { background: rgba(15, 30, 53, .52); backdrop-filter: blur(3px); }
.dialog-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); background: white; }
.dialog-header .eyebrow { margin-top: 0; }
.icon-button { width: 42px; height: 42px; color: var(--navy-soft); background: var(--canvas); font-size: 28px; }
#dialog-message { margin: 18px 26px 0; }
#order-detail-content { padding: 6px 26px 30px; }
#order-detail-content .detail-card { background: #fbfcfe; }
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #d8ebf4;
  border-radius: 16px;
  background: var(--blue-pale);
}
.dialog-actions p { flex: 1; margin: 0; color: var(--navy-soft); font-size: 14px; }
.alert-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)); gap: 14px; margin: 18px 0; }
.alert-summary > div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.alert-summary span { display: block; color: var(--muted); font-size: 13px; }
.alert-summary strong { display: block; margin-top: 4px; font-size: 26px; }
.alert-priority { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.alert-priority[data-severity="high"] { color: var(--red); background: #fff0f2; }
.alert-priority[data-severity="medium"] { color: #a05c14; background: #fff3e5; }
.section-title { margin: 26px 0 12px; }
.finance-filter { grid-template-columns: minmax(190px, 1fr) minmax(150px, .7fr) minmax(150px, .7fr) auto auto auto; }
.personnel-filter { grid-template-columns: minmax(220px, 1fr) auto; }
.personnel-editor { display: grid; gap: 26px; padding: 22px 26px 30px; }
.personnel-editor form { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; }
.personnel-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h3 { margin: 0; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.certificate-row { display: grid; grid-template-columns: 1fr 1fr minmax(150px, .6fr) auto; gap: 10px; align-items: end; margin-top: 10px; }
.certificate-row button { min-height: 46px; }
.region-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.region-options label { display: flex; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.region-options input { width: auto; }
.danger-link { color: var(--red); }
#complaint-detail-content { padding: 6px 26px 30px; }
#review-detail-content { padding: 6px 26px 30px; }
.dispatch-fields { flex: 1; display: grid; gap: 10px; }
.dispatch-fields p { margin: 0; }
.dispatch-fields select { width: 100%; max-width: 420px; background: white; }

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-card { justify-self: start; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
  .permission-card { grid-column: 1 / -1; margin-top: 6px; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .alert-summary { grid-template-columns: repeat(3, 1fr); }
  .login-shell { padding: 24px 18px 40px; gap: 28px; }
  .security-points { font-size: 14px; }
  .topbar { align-items: flex-start; padding: 12px 16px; }
  .topbar-brand .eyebrow { display: none; }
  .account-summary { align-items: flex-end; flex-direction: column; gap: 2px; }
  .workspace { padding: 18px 12px 50px; }
  .sidebar { position: sticky; top: 0; z-index: 4; padding: 8px; border-radius: 15px; background: rgba(243, 246, 250, .94); backdrop-filter: blur(8px); }
  .permission-card { display: none; }
  .nav-button { justify-content: center; padding: 8px; }
  .page-panel { padding: 20px 14px; border-radius: 18px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .filter-bar, .detail-grid { grid-template-columns: 1fr; }
  .personnel-form-grid, .certificate-row, .region-options { grid-template-columns: 1fr; }
  .detail-card dl > div { grid-template-columns: 105px minmax(0, 1fr); }
  .dialog-header, #order-detail-content { padding-left: 18px; padding-right: 18px; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
}
