:root {
  color-scheme: light;
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --primary: #0f6c81;
  --primary-dark: #0a5161;
  --soft: #e8f5f7;
  --accent: #f5b14c;
  --danger: #c43d3d;
  --warning: #a46200;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 108, 129, 0.16), transparent 34rem),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: #e7ecf5;
  color: var(--text);
}

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 18px auto 32px;
}

.panel,
.form-card,
.panel-lite,
.status-row article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.auth-panel {
  display: grid;
  gap: 24px;
  margin-top: 5vh;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.25rem);
}

h2 {
  font-size: 1.15rem;
}

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

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

.form-card,
.panel-lite {
  padding: 18px;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
  color: var(--text);
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  background: #edf4f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}

.tab {
  background: transparent;
  color: var(--text);
  flex: 0 0 auto;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.view-stack {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 2px;
}

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

.status-row article {
  padding: 18px;
  border-left: 4px solid var(--primary);
}

.status-row span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.status-row strong {
  font-size: 1.35rem;
}

.workbench,
.lists {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

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

.button-grid button:nth-child(2) {
  background: #455468;
}

.button-grid button:nth-child(3) {
  background: #7a5b18;
}

.button-grid button:nth-child(4) {
  background: #557b58;
}

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

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
  box-shadow: none;
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.inline-actions button {
  padding: 0.55rem 0.8rem;
}

.compliance-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
  background: #102a36;
  color: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.compliance-panel .muted {
  color: #c3d5dc;
}

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

.alert-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.alert-card span {
  color: #d9e8ee;
  line-height: 1.5;
}

.alert-card.danger {
  border-color: rgba(255, 127, 127, 0.55);
}

.alert-card.warning {
  border-color: rgba(245, 177, 76, 0.75);
}

.alert-card.notice {
  border-color: rgba(127, 191, 255, 0.55);
}

.alert-card.ok {
  border-color: rgba(124, 220, 160, 0.55);
}

.stat-bar {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.stat-bar > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-bar span {
  color: var(--muted);
}

meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}

meter::-webkit-meter-bar {
  background: #e8eef5;
  border: 0;
}

meter::-webkit-meter-optimum-value {
  background: var(--primary);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 360px;
  box-shadow: 0 16px 40px rgba(20, 31, 50, 0.22);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 820px) {
  .auth-grid,
  .status-row,
  .workbench,
  .lists,
  .compliance-panel {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }
}
