:root {
  --bg: #edf5fb;
  --surface: #ffffff;
  --surface-soft: #f6fbff;
  --line: #d5e4ef;
  --line-strong: #bfd4e4;
  --text: #102b46;
  --muted: #5d7285;
  --muted-2: #7a8c9c;
  --blue: #0b76b7;
  --blue-dark: #0d3457;
  --green: #168255;
  --amber: #a96a09;
  --red: #b43a3a;
  --purple: #6843a3;
  --shadow: 0 18px 50px rgba(23, 62, 95, .13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #e3f1fa 0%, #f8fbff 54%, #e9f3ef 100%);
  color: var(--text);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

button {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-card {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom-color: var(--line);
}

.login-brand strong {
  color: var(--text);
}

.login-brand span {
  color: var(--blue);
}

.login-card h1 {
  margin: 0;
  color: #0b2c4c;
  font-size: 34px;
  line-height: 1.18;
}

.login-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #163d5d;
  font-size: 14px;
  font-weight: 900;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.form-message {
  min-height: 24px;
  color: var(--red) !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background: var(--blue-dark);
  color: #d9ebf7;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #fff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: .04em;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 17px;
  line-height: 1.25;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #9fc4df;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.role-button,
.nav-button,
.primary-button,
.secondary-button {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 900;
}

.role-button {
  background: rgba(255, 255, 255, .08);
  color: #cfe2f1;
}

.role-button.is-active {
  background: #fff;
  color: var(--blue-dark);
}

.role-button:disabled {
  cursor: not-allowed;
  opacity: .46;
}

.role-switch.is-locked .role-button.is-active {
  opacity: 1;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: transparent;
  color: #b9d1e5;
  text-align: left;
}

.nav-button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.nav-button.is-active {
  background: var(--blue);
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  color: #fff;
  margin-bottom: 6px;
}

.sidebar-note span {
  color: #c8dcea;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 700;
}

.logout-button {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.main {
  padding: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
}

h1 {
  margin: 0;
  color: #0b2c4c;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.12;
}

.page-subtitle {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 700;
}

.page-subtitle .data-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button {
  padding: 0 16px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #fff;
  border-color: var(--line-strong);
  color: #174866;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel,
.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 126px;
  padding: 18px;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.kpi-value {
  margin-top: 10px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.kpi-note {
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel.is-wide {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.panel-header h2 {
  margin: 0;
  font-size: 19px;
  color: #133755;
}

.panel-body {
  padding: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table th,
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid #e6eff6;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  background: #fbfdff;
  font-size: 13px;
  font-weight: 900;
}

.table td {
  color: #243f56;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
}

.table tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7f3fb;
  color: #126092;
  font-size: 12px;
  font-weight: 900;
}

.tag.green {
  background: #e7f6ee;
  color: var(--green);
}

.tag.amber {
  background: #fff1d9;
  color: var(--amber);
}

.tag.red {
  background: #fde9e9;
  color: var(--red);
}

.tag.purple {
  background: #f1eafd;
  color: var(--purple);
}

.tag.gray {
  background: #edf2f6;
  color: #566b7a;
}

.progress-track {
  height: 9px;
  margin-top: 6px;
  border-radius: 999px;
  background: #dfebf4;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 13px;
  border: 1px solid #deebf4;
  border-radius: 13px;
  background: #fbfdff;
}

.list-item::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.list-item.priority-high::before {
  background: var(--red);
}

.list-item.priority-medium::before {
  background: #d89220;
}

.list-item.priority-ok::before {
  background: var(--green);
}

.list-item strong {
  display: block;
  color: #173a59;
  font-size: 14px;
  line-height: 1.35;
}

.list-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-card {
  min-height: 116px;
  padding: 16px;
  box-shadow: none;
}

.mini-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #163d5d;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar .tag {
  background: #fff;
  border: 1px solid var(--line-strong);
}

.empty-note {
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  background: #fbfdff;
  font-weight: 700;
  line-height: 1.6;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .role-switch,
  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-note {
    margin-top: 0;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 22px 14px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }

  .kpi-grid,
  .mini-grid,
  .role-switch,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .table {
    table-layout: auto;
  }

  .panel {
    overflow-x: auto;
  }
}
