:root {
  --bg: #eef2f1;
  --panel: #ffffff;
  --text: #1f2a2a;
  --muted: #69716d;
  --line: #dbe3df;
  --primary: #0e6f64;
  --primary-dark: #183c3b;
  --gold: #b08a3c;
  --blue: #315f9d;
  --amber: #996312;
  --red: #c2413b;
  --green-soft: #eaf7f2;
  --blue-soft: #eaf2ff;
  --amber-soft: #fff5de;
  --red-soft: #fef2f2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #eef2f1 0%, #f6f7f5 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(24, 60, 59, 0.94), rgba(31, 42, 42, 0.98)),
    #183c3b;
}

.login-screen.hidden {
  display: none;
}

.login-panel {
  width: min(420px, calc(100vw - 36px));
  border-radius: 12px;
  background: #ffffff;
  padding: 30px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
}

.login-brand {
  margin-bottom: 24px;
  padding: 0;
  border: 0;
}

.login-brand .brand-title {
  color: var(--primary-dark);
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-panel h1 {
  margin-bottom: 8px;
  font-size: 26px;
}

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

.login-input {
  width: 100%;
  min-height: 42px;
  margin-bottom: 12px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 8px;
  padding: 0 13px;
}

.login-button {
  width: 100%;
  margin-top: 6px;
}

.app-shell {
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(24, 60, 59, 0.98), rgba(31, 42, 42, 0.99)),
    #183c3b;
  padding: 26px 18px;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  padding: 0 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d6b56d, #9a722b);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.brand-title {
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  padding: 0 16px;
  transition: 0.18s ease;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold);
}

.main {
  min-width: 0;
  padding: 30px 34px 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(31, 42, 42, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 20px 22px;
  box-shadow: 0 18px 42px rgba(31, 42, 42, 0.06);
  backdrop-filter: blur(10px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
}

.top-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.admin-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(31, 42, 42, 0.1);
  border-radius: 999px;
  background: #ffffff;
  padding: 0 15px;
  color: #344341;
  font-weight: 700;
}

.logout-button {
  min-height: 28px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: #344341;
  padding: 0 10px;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0e6f64;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.command-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 28px 30px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(24, 60, 59, 0.96), rgba(31, 42, 42, 0.98)),
    #183c3b;
  color: #ffffff;
  box-shadow: 0 24px 50px rgba(31, 42, 42, 0.18);
}

.banner-kicker {
  display: block;
  margin-bottom: 10px;
  color: #e5ce93;
  font-size: 12px;
  font-weight: 800;
}

.command-banner h2 {
  margin: 0 0 9px;
  font-size: 24px;
  letter-spacing: 0;
}

.command-banner p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.7);
}

.banner-button {
  flex: none;
  min-height: 42px;
  border: 1px solid rgba(229, 206, 147, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, #d6b56d, #9a722b);
  color: #ffffff;
  padding: 0 18px;
  font-weight: 800;
}

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

.metric-card,
.panel {
  border: 1px solid rgba(31, 42, 42, 0.08);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 38px rgba(31, 42, 42, 0.06);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 20px;
}

.metric-label,
.metric-note {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 14px 0 8px;
  color: var(--primary-dark);
  font-size: 36px;
  letter-spacing: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
}

.panel {
  padding: 20px;
}

.panel-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel h2 {
  color: var(--primary-dark);
  font-size: 18px;
}

.toolbar {
  margin-bottom: 16px;
  border: 1px solid rgba(31, 42, 42, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(31, 42, 42, 0.05);
}

.search-input,
.select {
  min-height: 40px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.search-input {
  width: min(420px, 100%);
  padding: 0 13px;
}

.select {
  padding: 0 12px;
}

.primary-button,
.ghost-button,
.danger-button,
.plain-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
}

.primary-button {
  border: 1px solid var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(14, 111, 100, 0.18);
}

.ghost-button,
.plain-button {
  border: 1px solid rgba(31, 42, 42, 0.12);
  background: #ffffff;
  color: #344341;
}

.danger-button {
  border: 1px solid #f3c4c1;
  background: #fff7f7;
  color: var(--red);
}

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

.empty-panel,
.empty-cell {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.empty-panel {
  border: 1px dashed rgba(31, 42, 42, 0.14);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 18px;
}

.empty-cell {
  padding: 32px 16px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(31, 42, 42, 0.08);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.task-title {
  display: block;
  margin-bottom: 5px;
  color: var(--primary-dark);
  font-weight: 800;
}

.task-meta {
  color: var(--muted);
  font-size: 13px;
}

.progress-list {
  display: grid;
  gap: 18px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e8e5;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

.table-panel {
  overflow-x: auto;
  padding: 0;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(31, 42, 42, 0.08);
  padding: 15px 16px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f6f8f7;
  color: #53605b;
  font-size: 13px;
  font-weight: 700;
}

td {
  color: #293735;
  font-size: 14px;
}

.cell-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.permission-cell {
  max-width: 260px;
  white-space: normal;
  line-height: 1.6;
}

.wrap-cell {
  max-width: 320px;
  white-space: normal;
  line-height: 1.65;
}

tbody tr:hover {
  background: #fbfcfb;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.green {
  background: var(--green-soft);
  color: var(--primary);
}

.badge.blue {
  background: var(--blue-soft);
  color: #1d4ed8;
}

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

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

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button {
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(31, 42, 42, 0.48);
  padding: 24px;
}

.modal-mask.show {
  display: flex;
}

.modal-panel {
  width: min(680px, 100%);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(31, 42, 42, 0.08);
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid rgba(31, 42, 42, 0.08);
  border-bottom: 0;
}

.modal-head h2 {
  color: var(--primary-dark);
  font-size: 18px;
}

.modal-close {
  min-height: 32px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: #344341;
  padding: 0 10px;
}

.modal-body {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  padding: 20px;
}

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

.detail-item {
  border: 1px solid rgba(31, 42, 42, 0.08);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

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

.detail-value {
  color: var(--text);
  font-weight: 700;
  white-space: normal;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.attachment-list a {
  border: 1px solid rgba(14, 111, 100, 0.18);
  border-radius: 8px;
  background: #eaf7f2;
  color: var(--primary);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

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

.form-field {
  display: grid;
  gap: 7px;
}

.form-field.wide {
  grid-column: 1 / -1;
}

.form-field label {
  color: #344341;
  font-size: 13px;
  font-weight: 700;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
}

.form-field textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.form-field input[type="file"] {
  padding: 8px 12px;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.upload-grid-admin {
  margin-top: 14px;
}

.permission-block {
  margin-top: 14px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(31, 42, 42, 0.1);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 0 10px;
  color: #344341;
  font-size: 13px;
  font-weight: 700;
}

.permission-option input {
  width: 16px;
  height: 16px;
}

.readonly-note {
  border-radius: 8px;
  background: #fff5de;
  color: #996312;
  padding: 12px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #1f2a2a;
  color: #ffffff;
  padding: 12px 16px;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    height: auto;
    padding: 14px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .content-grid,
  .command-banner {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .form-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .command-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}
