:root {
  --navy: #0f3d6e;
  --navy-deep: #082744;
  --blue: #1f6feb;
  --blue-soft: #e8f1ff;
  --teal: #0f9d8a;
  --ink: #102a43;
  --ink-sub: #52606d;
  --ink-soft: #7b8a9a;
  --line: #dce8f5;
  --surface: #ffffff;
  --bg: #f3f8fd;
  --danger: #c0394f;
  --warning: #b25b00;
  --shadow: 0 20px 50px rgba(15, 61, 110, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 4%, rgba(31, 111, 235, 0.12), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(15, 157, 138, 0.1), transparent 26%),
    var(--bg);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

.brand-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(15, 61, 110, 0.18));
}

.brand-mark--small {
  width: 38px;
  height: 38px;
  filter: none;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.login-brand strong,
.sidebar-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.login-brand span,
.sidebar-brand small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.login-desc {
  margin: 10px 0 24px;
  color: var(--ink-sub);
  font-size: 14px;
  line-height: 1.7;
}

.login-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-sub);
  font-size: 13px;
  font-weight: 700;
}

.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.password-field:focus-within {
  border-color: rgba(31, 111, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.1);
}

.password-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 10px 0;
  background: transparent;
}

.password-field button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #155bd6);
  box-shadow: 0 12px 26px rgba(31, 111, 235, 0.24);
}

.btn-ghost {
  color: var(--navy);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-danger {
  color: #ffffff;
  background: var(--danger);
}

.btn-small {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}

.login-back {
  display: inline-block;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}

.login-back:hover {
  color: var(--blue);
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 18px;
  color: #eaf3ff;
  background:
    radial-gradient(circle at 20% 0%, rgba(31, 111, 235, 0.4), transparent 32%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 26px;
  color: inherit;
  text-decoration: none;
}

.sidebar-brand small {
  color: rgba(234, 243, 255, 0.62);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  color: rgba(234, 243, 255, 0.72);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.is-active {
  color: var(--navy-deep);
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.14);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 16px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(234, 243, 255, 0.62);
  font-size: 12px;
}

.logout-btn {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.main {
  min-width: 0;
  padding: 28px 32px 46px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 7px 0 0;
  color: var(--ink-sub);
  font-size: 14px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section {
  display: none;
  animation: rise-in 0.22s ease;
}

.section.is-active {
  display: block;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.toolbar-info {
  color: var(--ink-sub);
  font-size: 14px;
}

.toolbar-info strong {
  color: var(--ink);
}

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

.toolbar--records {
  align-items: flex-start;
}

.range-inputs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
}

.range-inputs input {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.filter-card {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
}

.filter-card input,
.filter-card select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.filter-card input:focus,
.filter-card select:focus {
  border-color: rgba(31, 111, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(15, 61, 110, 0.07);
}

.theme-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.theme-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.theme-card-sub {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--teal);
  background: rgba(15, 157, 138, 0.12);
  font-size: 11px;
  font-weight: 700;
}

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

.badge--off {
  color: #8a3944;
  background: #fde8eb;
}

.theme-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--ink-sub);
  font-size: 12px;
}

.theme-card-meta div {
  padding: 9px 10px;
  border-radius: 9px;
  background: #f5f9ff;
}

.theme-card-meta span {
  display: block;
  color: var(--ink-soft);
  font-size: 10px;
}

.theme-card-meta strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 12px;
  word-break: break-all;
}

.theme-card-desc {
  margin: 0;
  color: var(--ink-sub);
  font-size: 12px;
  line-height: 1.7;
}

.theme-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.link-btn {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.link-btn:hover {
  text-decoration: underline;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(15, 61, 110, 0.06);
}

.data-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #edf3fa;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--ink-soft);
  background: #f7fbff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: #f9fcff;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .col-actions {
  width: 130px;
}

.table-actions {
  display: flex;
  gap: 10px;
}

.status-text--done {
  color: var(--teal);
  font-weight: 700;
}

.status-text--active {
  color: var(--blue);
  font-weight: 700;
}

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

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.pager-size {
  color: var(--ink-sub);
  font-size: 12px;
}

.pager-size select {
  margin-left: 4px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.stat-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(15, 61, 110, 0.06);
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -0.03em;
}

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

.panel {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(15, 61, 110, 0.06);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-meta {
  color: var(--ink-soft);
  font-size: 11px;
}

.stat-list,
.ranking-list {
  display: grid;
  gap: 8px;
}

.stat-row,
.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f7fbff;
  font-size: 13px;
}

.stat-row strong,
.ranking-row strong {
  color: var(--navy);
}

.stat-row small,
.ranking-row small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.ranking-row__rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
}

.ranking-row__main {
  flex: 1;
  min-width: 0;
}

.ranking-row__hours {
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 39, 68, 0.48);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(8, 39, 68, 0.28);
}

.modal--small {
  width: min(420px, 100%);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 21px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: var(--ink-sub);
  background: #f1f6fc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
  background: #fde8eb;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-sub);
  font-size: 12px;
  font-weight: 700;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 400;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(31, 111, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.field input:disabled {
  color: var(--ink-soft);
  background: #f4f7fb;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-sub);
  font-size: 13px;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #edf3fa;
}

.confirm-text {
  margin: 0 0 20px;
  color: var(--ink-sub);
  font-size: 14px;
  line-height: 1.8;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 80;
  max-width: min(440px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 14px;
  color: #ffffff;
  background: rgba(15, 61, 110, 0.94);
  box-shadow: 0 18px 40px rgba(15, 61, 110, 0.22);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: 0.22s ease;
}

.toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast--error {
  background: rgba(164, 49, 65, 0.96);
}

.toast--success {
  background: rgba(13, 120, 104, 0.96);
}

@media (max-width: 1100px) {
  .filter-card {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
  }

  .sidebar-brand {
    padding: 0;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-item {
    width: auto;
    padding: 9px 12px;
    font-size: 13px;
  }

  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    margin: 0 0 0 auto;
    padding: 0;
    border-top: 0;
  }

  .main {
    padding: 22px 18px 38px;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .filter-card {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 600px) {
  .login-card {
    padding: 26px 20px;
  }

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

  .page-head h1 {
    font-size: 24px;
  }

  .filter-card {
    grid-template-columns: 1fr;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

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

  .modal {
    padding: 20px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .range-inputs {
    width: 100%;
  }

  .range-inputs input {
    flex: 1;
  }
}
