:root {
  --bg: #f5efe6;
  --panel: rgba(255, 251, 245, 0.9);
  --line: rgba(111, 85, 44, 0.14);
  --text: #2b2219;
  --muted: #766451;
  --primary: #0f766e;
  --primary-deep: #0b5f58;
  --danger: #b94537;
  --shadow: 0 20px 48px rgba(82, 52, 22, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --mono: "Cascadia Code", Consolas, monospace;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(185, 69, 55, 0.1), transparent 24%),
    linear-gradient(135deg, #f8f3ec 0%, #eee4d5 100%);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-body {
  overflow: hidden;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(12px);
  pointer-events: none;
}

.ambient-a {
  width: 360px;
  height: 360px;
  top: -80px;
  right: -60px;
  background: rgba(15, 118, 110, 0.16);
}

.ambient-b {
  width: 320px;
  height: 320px;
  left: -60px;
  bottom: -80px;
  background: rgba(185, 69, 55, 0.14);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-simple-card,
.sidebar,
.panel,
.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-simple-card {
  width: min(420px, 100%);
  border-radius: 28px;
  padding: 28px;
}

.login-brand {
  margin-bottom: 8px;
  text-align: center;
}

.login-brand h1,
.sidebar h1,
.panel h2 {
  margin: 0;
}

.login-brand h1 {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

.login-brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.field span {
  font-size: 0.9rem;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px 14px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
  transform: translateY(-1px);
}

.primary-btn,
.ghost-btn,
.menu-btn {
  min-height: 42px;
  border-radius: 13px;
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.menu-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  width: 100%;
  margin-top: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 16px 28px rgba(15, 118, 110, 0.18);
}

.ghost-btn,
.menu-btn {
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.ghost-btn.danger {
  color: var(--danger);
}

.menu-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent;
}

.small {
  color: var(--muted);
  line-height: 1.5;
}

.tiny-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.error {
  min-height: 22px;
  margin-top: 12px;
  color: var(--danger);
}

.status-msg {
  min-height: 24px;
  margin-top: 12px;
  color: var(--primary-deep);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.sidebar {
  margin: 16px 0 16px 16px;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.sidebar-top p {
  margin: 8px 0 0;
}

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

.main-content {
  padding: 16px;
  display: grid;
  gap: 14px;
}

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

.summary-card {
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
}

.summary-label {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 1.08rem;
}

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

.form-grid {
  display: grid;
  gap: 12px;
}

.mode-fields {
  margin-top: 12px;
}

.form-toolbar {
  margin-top: 14px;
}

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

.toolbar-tight {
  gap: 6px;
}

.panel-action-btn,
.table-btn {
  min-height: 36px;
  font-size: 0.88rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

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

.table th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.empty-cell {
  text-align: center;
  padding: 22px 12px !important;
}

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

.status-dot {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--primary-deep);
  font-size: 0.8rem;
}

.log-panel {
  min-height: 400px;
}

.log-box {
  margin: 0;
  min-height: 320px;
  max-height: 58vh;
  overflow: auto;
  padding: 16px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(29, 33, 38, 0.98), rgba(20, 23, 28, 0.98)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 28px,
      rgba(255, 255, 255, 0.03) 28px,
      rgba(255, 255, 255, 0.03) 56px
    );
  color: #e6e1d8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.58;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .console-shell,
  .summary-grid,
  .compact-form-grid,
  .mode-fields {
    grid-template-columns: 1fr;
  }

  .sidebar {
    margin: 16px;
  }

  .main-content {
    padding-top: 0;
  }
}

@media (max-width: 720px) {
  .login-shell,
  .main-content,
  .panel,
  .sidebar,
  .login-simple-card {
    padding: 16px;
  }

  .console-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0;
    border-radius: 0 0 18px 18px;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 12px 14px 14px;
    gap: 12px;
    background: rgba(255, 248, 240, 0.94);
    backdrop-filter: blur(18px);
    box-shadow: 0 14px 26px rgba(82, 52, 22, 0.1);
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .sidebar-top h1 {
    font-size: 1.05rem;
  }

  .sidebar-top .small {
    margin: 4px 0 0;
    font-size: 0.78rem;
  }

  .sidebar > .ghost-btn.danger {
    width: auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
    border-radius: 999px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.07);
    border: 1px solid rgba(15, 118, 110, 0.1);
  }

  .menu-btn {
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.8rem;
    border-radius: 12px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  .menu-btn.active {
    box-shadow: 0 10px 18px rgba(15, 118, 110, 0.18);
  }

  .main-content {
    padding: 12px;
    gap: 12px;
  }

  .panel-head {
    flex-direction: column;
  }

  .toolbar,
  .row-actions {
    width: 100%;
  }

  .panel-action-btn,
  .ghost-btn,
  .primary-btn,
  .table-btn {
    width: 100%;
  }

  .summary-card {
    padding: 10px 12px;
  }

  .summary-label {
    font-size: 0.68rem;
  }

  .summary-card strong {
    margin-top: 6px;
    font-size: 1.08rem;
  }

  .panel {
    border-radius: 18px;
    padding: 14px;
  }

  .panel-head h2 {
    font-size: 1rem;
  }

  .table {
    min-width: 640px;
  }

  .log-box {
    min-height: 260px;
    max-height: 46vh;
    font-size: 0.82rem;
  }
}
