:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d8dee6;
  --text: #17202a;
  --muted: #687385;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --blue: #2563eb;
  --red: #dc2626;
  --amber: #d97706;
  --green: #15803d;
  --slate: #334155;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  background: #102027;
  color: #d7e2e4;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.3;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: #9fb2b7;
}

.nav-group {
  margin: 18px 0;
}

.nav-title {
  padding: 0 8px 8px;
  font-size: 12px;
  color: #8ea1a7;
}

.nav-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d7e2e4;
  background: transparent;
  border-radius: 6px;
  padding: 9px 10px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
}

.main {
  min-width: 0;
  padding: 22px 28px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0 0 5px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.role-switch {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.role-switch button {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.role-switch button.active {
  background: var(--brand);
  color: white;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 18px;
}

.stat {
  padding: 16px;
}

.stat label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 28px;
  line-height: 1;
}

.stat small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  background: var(--brand);
}

.btn:hover {
  background: var(--brand-strong);
}

.btn.secondary {
  color: var(--text);
  background: #edf2f7;
}

.btn.danger {
  background: var(--red);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 8px 10px;
}

.textarea {
  min-height: 78px;
  resize: vertical;
}

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

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--panel-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: #e2e8f0;
  color: var(--slate);
}

.badge.green {
  background: #dcfce7;
  color: var(--green);
}

.badge.red {
  background: #fee2e2;
  color: var(--red);
}

.badge.amber {
  background: #fef3c7;
  color: var(--amber);
}

.badge.blue {
  background: #dbeafe;
  color: var(--blue);
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.notice {
  border: 1px solid #b7dcd7;
  background: #ecfdf8;
  color: #0f5f59;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.6;
}

.mobile-frame {
  max-width: 390px;
  margin: 0 auto;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.mobile-screen {
  min-height: 620px;
  background: white;
  border-radius: 18px;
  overflow: hidden;
}

.mobile-header {
  background: var(--brand);
  color: white;
  padding: 18px;
}

.mobile-header h3 {
  margin: 0 0 5px;
}

.mobile-content {
  padding: 14px;
}

.mobile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef6f4, #f8fafc);
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 20px;
  z-index: 20;
}

.modal {
  width: min(780px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
}

.link-button {
  color: var(--brand);
  background: transparent;
  padding: 0;
}

.file-chip {
  display: inline-flex;
  margin: 3px 4px 3px 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6f4;
  color: var(--brand-strong);
  font-size: 12px;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .grid.cols-4,
  .grid.cols-3,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px 14px 32px;
  }
}
