:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #617080;
  --line: #d9e1e8;
  --brand: #16786a;
  --brand-dark: #0c5d51;
  --accent: #2d6cdf;
  --warn: #b36b00;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(20, 34, 51, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  transition:
    background 0.16s ease,
    transform 0.16s ease;
}

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

button:active {
  transform: translateY(1px);
}

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

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

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: 100vh;
  background: #e8eef1;
}

.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.login-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(0.95);
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 35, 32, 0.72), rgba(8, 35, 32, 0.08));
}

.login-copy {
  position: absolute;
  left: clamp(28px, 6vw, 86px);
  bottom: clamp(38px, 8vh, 90px);
  z-index: 1;
  max-width: 640px;
  color: #fff;
}

.login-copy p,
.login-copy span {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.login-copy h1 {
  margin: 14px 0;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: 0;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 48px;
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 22px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

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

.brand.compact strong,
.brand.compact span {
  color: #fff;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #334150;
  font-size: 14px;
}

.login-form button {
  margin-top: 4px;
  min-height: 44px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.demo-accounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.demo-accounts button,
.top-actions button,
.toolbar-actions button,
.row-actions button,
.edit-dialog footer button:first-child {
  background: #eef3f6;
  color: #23313f;
}

.demo-accounts button:hover,
.top-actions button:hover,
.toolbar-actions button:hover,
.row-actions button:hover,
.edit-dialog footer button:first-child:hover {
  background: #dfe8ee;
}

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

.sidebar {
  background: #14322e;
  color: #fff;
}

.module-nav {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.module-nav button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 42px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.module-nav button.active,
.module-nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.topbar p,
.topbar h2 {
  margin: 0;
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
}

.top-actions,
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

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

.stat-card,
.notice-list,
.chart-panel,
.module-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.notice-list,
.chart-panel {
  padding: 18px;
}

.notice-list h3,
.chart-panel h3,
.module-panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.notice-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.notice-item:first-of-type {
  border-top: 0;
}

.notice-item strong {
  display: block;
}

.notice-item p {
  margin: 6px 0;
  color: #334150;
}

.notice-item span {
  color: var(--muted);
  font-size: 13px;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e6edf1;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.module-panel {
  overflow: hidden;
}

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

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

.toolbar-actions input {
  width: 240px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  background: #f8fafb;
  color: #394758;
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: #25313d;
}

.truncate {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9f6f2;
  color: #0f6f5f;
  font-size: 12px;
  white-space: nowrap;
}

.badge.warn {
  background: #fff4df;
  color: var(--warn);
}

.badge.danger {
  background: #fdeceb;
  color: var(--danger);
}

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

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.edit-dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.edit-dialog::backdrop {
  background: rgba(8, 20, 30, 0.46);
}

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

.edit-dialog footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.edit-dialog h3 {
  margin: 0;
}

#closeDialogButton {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #eef3f6;
  color: #23313f;
  font-size: 22px;
  line-height: 1;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: #334150;
  font-size: 14px;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

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

  .login-visual {
    min-height: 34vh;
  }

  .login-panel {
    padding: 28px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

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

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

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .panel-toolbar,
  .top-actions,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions input,
  .toolbar-actions button,
  .top-actions button {
    width: 100%;
  }

  .module-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid,
  .form-grid,
  .demo-accounts {
    grid-template-columns: 1fr;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .bar-row {
    grid-template-columns: 72px minmax(0, 1fr) 42px;
  }
}
