:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e3f0;
  --panel: #ffffff;
  --soft: #f5f8fc;
  --nav: #0b1f3a;
  --nav-2: #0f3158;
  --blue: #1f6feb;
  --cyan: #0ea5e9;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(31, 111, 235, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 111, 235, 0.035) 1px, transparent 1px),
    #eef4fb;
  background-size: 28px 28px;
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
}

.login-side {
  background:
    radial-gradient(circle at 18% 20%, rgba(14, 165, 233, 0.24), transparent 32%),
    linear-gradient(135deg, #061830, #0c2d52 55%, #10395f);
  color: #f8fbff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(90deg, #000 0%, transparent 86%);
}

.brand-lockup,
.platform-lines {
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(125, 211, 252, 0.85);
  background: rgba(14, 165, 233, 0.15);
  display: grid;
  place-items: center;
  border-radius: 8px;
  margin-bottom: 18px;
}

.brand-mark span {
  display: block;
  width: 24px;
  height: 18px;
  border: 2px solid #7dd3fc;
  border-left-width: 7px;
}

.login-side h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: 0;
}

.login-side p {
  margin: 0;
  max-width: 520px;
  color: #c9e3ff;
  line-height: 1.8;
}

.platform-lines {
  display: grid;
  gap: 10px;
}

.platform-lines div {
  border-left: 3px solid #38bdf8;
  padding-left: 12px;
  color: #dbeafe;
}

.login-main {
  display: grid;
  place-items: center;
  padding: 36px;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  padding: 30px;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-card .sub {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-password-field {
  margin-top: 14px;
}

.login-submit {
  width: 100%;
  margin-top: 22px;
}

.login-hint {
  margin-top: 16px;
  line-height: 1.8;
}

.platform-lines .login-icp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  margin-top: 14px;
  padding: 7px 12px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.1);
  font-size: 11px;
  color: #a9cbed;
  line-height: 1.5;
  letter-spacing: 0.2px;
}

.platform-lines .login-icp svg {
  width: 12px;
  height: 12px;
  flex: none;
  color: #7dd3fc;
}

.login-icp a {
  color: inherit;
  text-decoration: none;
}

.login-icp a:hover {
  text-decoration: underline;
}

.login-icp a:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
  border-radius: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(180deg, var(--nav), #071528);
  background-size: 26px 26px, 26px 26px, auto;
  color: #d8edff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
}

.side-head {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.side-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.side-sub {
  margin-top: 4px;
  color: #93c5fd;
  font-size: 12px;
}

.nav-list {
  padding: 14px 12px;
  display: grid;
  gap: 6px;
}

.nav-btn {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #c9e4ff;
  background: transparent;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(14, 165, 233, 0.16);
  color: #ffffff;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #7dd3fc;
}

.side-foot {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.user-chip {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0ea5e9;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: rgba(255,255,255,0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}

.page-title h2 {
  margin: 0;
  font-size: 24px;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

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

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

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

.entry-stack {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

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

.card-head h3 {
  margin: 0;
  font-size: 16px;
}

.card-body {
  padding: 16px;
}

.metric {
  padding: 16px;
  min-height: 118px;
  display: grid;
  align-content: space-between;
}

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

.metric .value {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  margin: 12px 0 6px;
}

.metric .hint {
  font-size: 12px;
  color: var(--muted);
}

.metric.blue { border-top: 4px solid var(--blue); }
.metric.green { border-top: 4px solid var(--green); }
.metric.amber { border-top: 4px solid var(--amber); }
.metric.orange { border-top: 4px solid #f97316; }
.metric.red { border-top: 4px solid var(--red); }
.metric.violet { border-top: 4px solid var(--violet); }

.home-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 420px);
  gap: 14px;
  align-items: start;
}

.home-main-column,
.home-side-column {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.home-side-column {
  align-self: start;
}

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

.home-log-card {
  grid-column: 1 / -1;
}

.home-info-card .card-head {
  align-items: flex-start;
  padding: 13px 14px;
}

.home-info-card .card-body {
  padding: 12px 14px;
}

.home-info-meta,
.home-info-subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}

.home-weather-list,
.home-news-list {
  display: grid;
}

.home-weather-list {
  gap: 10px;
}

.home-news-list {
  gap: 0;
}

.weather-port-row {
  min-width: 0;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
}

.weather-port-main,
.news-row > div:first-child {
  min-width: 0;
}

.weather-port-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.weather-port-row .strong,
.weather-port-row .muted,
.news-row .strong,
.news-row .muted {
  overflow-wrap: anywhere;
}

.weather-port-main .strong {
  overflow-wrap: normal;
  word-break: keep-all;
}

.weather-port-main .home-info-subtle {
  flex: 0 1 auto;
  margin-top: 0;
  text-align: right;
}

.weather-port-row.muted-row {
  background: #f1f5f9;
}

.weather-facts {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.weather-condition {
  grid-column: auto;
}

.weather-fact {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
}

.weather-fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.weather-fact strong {
  display: block;
  color: #0f766e;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: keep-all;
}

.weather-condition strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.weather-condition strong.weather-condition-sm {
  font-size: 14px;
}

.weather-condition strong.weather-condition-xs {
  font-size: 12px;
}

.weather-fact.weather-temperature strong {
  font-size: 15px;
  white-space: nowrap;
}

.news-row {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.news-row:last-of-type {
  border-bottom: 0;
}

.news-row:hover .strong {
  color: #0369a1;
}

.news-open {
  flex: 0 0 auto;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.home-info-error {
  border-left: 3px solid #f97316;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 8px;
  padding: 8px 10px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn,
.btn {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
}

.tab-btn.active {
  background: #e7f5ff;
  border-color: #8bd3ff;
  color: #075985;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}

.btn.primary {
  color: #fff;
  border-color: #1d4ed8;
  background: #1f6feb;
}

.btn.green {
  color: #fff;
  border-color: #15803d;
  background: var(--green);
}

.btn.red {
  color: #fff;
  border-color: #b91c1c;
  background: var(--red);
}

.btn.ghost {
  background: transparent;
}

.sidebar .btn.ghost {
  color: #d8edff;
  border-color: rgba(125, 211, 252, 0.35);
}

.btn.small {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn:focus-visible,
.tab-btn:focus-visible {
  outline: 3px solid rgba(14, 165, 233, 0.28);
  outline-offset: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
}

.badge.pending { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.deleted,
.badge.scrapped { background: #e2e8f0; color: #334155; }
.badge.warning { background: #fee2e2; color: #b91c1c; }
.badge.alert { background: #ffedd5; color: #c2410c; }
.badge.unread { background: #dbeafe; color: #1d4ed8; }
.badge.archived { background: #f1f5f9; color: #475569; }

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

.field {
  display: grid;
  gap: 6px;
}

.field.span-2 { grid-column: span 2; }
.field.span-4 { grid-column: span 4; }
.form-section-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px 10px;
  border-left: 3px solid #0ea5e9;
  background: #f8fafc;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}
.field-note,
.section-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.section-note {
  margin-bottom: 12px;
}
.import-file-name {
  min-height: 24px;
  color: #075985;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.weather-source {
  border-top: 1px dashed #cbd5e1;
  padding-top: 8px;
  min-width: 0;
}

.weather-source > a,
.weather-source > span {
  color: #0369a1;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  width: 100%;
  max-width: 100%;
}

.import-file-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.import-file-status .import-file-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.calc-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.calc-preview span {
  min-height: 54px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 9px 10px;
  display: grid;
  gap: 4px;
}
.calc-preview b {
  color: var(--muted);
  font-size: 12px;
}

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

.cols-2 > .card .field.span-4 {
  grid-column: span 2;
}

label {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

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

input[type="file"] {
  padding: 6px 10px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

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

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

.filters input,
.filters select {
  width: 170px;
}

.checkbox-inline {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
}

.checkbox-inline input {
  width: auto;
  min-height: auto;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 12px;
}

.chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef6ff;
  color: #075985;
  font-size: 12px;
  font-weight: 600;
}

.multi-filter {
  position: relative;
  width: 170px;
}

.multi-filter.wide {
  width: 210px;
}

.multi-filter summary {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  list-style: none;
  cursor: pointer;
}

.multi-filter summary::-webkit-details-marker {
  display: none;
}

.multi-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.15);
}

.multi-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

td.center,
th.center {
  text-align: center;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  color: #334155;
  font-weight: 700;
}

tr:hover td {
  background: #f8fbff;
}

.detail-source-row > td {
  background: #f8fbff;
  border-bottom-color: #bfdbfe;
}

.inline-detail-row > td,
.inline-detail-row:hover > td {
  padding: 0 12px 12px;
  background: #f8fbff;
}

.inline-record-detail {
  min-width: 880px;
}

.inline-record-detail .detail-panel {
  margin-top: 10px;
  border-color: #bfdbfe;
  box-shadow: 0 6px 18px rgba(30, 64, 175, 0.08);
}

.inline-detail-history {
  margin-top: 10px;
  padding: 12px 14px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.inline-detail-history .toolbar {
  margin-bottom: 4px;
}

.inline-detail-history .list-row {
  padding: 8px 0;
}

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

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

.pager-actions {
  align-items: center;
}

.pager-actions select {
  width: auto;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.pager-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pager-ellipsis {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  color: var(--muted);
}

.pager .btn.active {
  border-color: #1f6feb;
  background: #dbeafe;
  color: #1d4ed8;
}

.detail-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

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

.detail-item {
  min-height: 68px;
  padding: 10px;
  background: #fff;
}

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

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

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

.list-row:last-child {
  border-bottom: 0;
}

.row-actions {
  align-items: flex-start;
}

.row-more {
  position: relative;
}

.row-more summary {
  list-style: none;
}

.row-more summary::-webkit-details-marker {
  display: none;
}

.row-more-menu {
  position: static;
  margin-top: 6px;
  min-width: 132px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.scope-note,
.permission-status {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.permission-status {
  margin: 0 0 10px;
  color: #075985;
  font-weight: 700;
}

.archived-row {
  background: #f8fafc;
}

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

.strong {
  font-weight: 700;
}

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

.pie-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.pie-chart {
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 20px #fff;
}

.bar-row {
  display: grid;
  grid-template-columns: 112px 1fr 42px;
  gap: 10px;
  align-items: center;
}

.bar-progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  appearance: none;
}

.bar-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #e2e8f0;
}

.bar-progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.bar-progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.chart-list .bar-row:nth-child(4n + 1) .bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #1f6feb, #0ea5e9); }
.chart-list .bar-row:nth-child(4n + 2) .bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #16a34a, #22c55e); }
.chart-list .bar-row:nth-child(4n + 3) .bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #d97706, #f59e0b); }
.chart-list .bar-row:nth-child(4n + 4) .bar-progress::-webkit-progress-value { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.chart-list .bar-row:nth-child(4n + 1) .bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #1f6feb, #0ea5e9); }
.chart-list .bar-row:nth-child(4n + 2) .bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #16a34a, #22c55e); }
.chart-list .bar-row:nth-child(4n + 3) .bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #d97706, #f59e0b); }
.chart-list .bar-row:nth-child(4n + 4) .bar-progress::-moz-progress-bar { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }

/* ===== SVG Charts (statistics) ===== */
.svg-chart {
  width: 100%;
  height: auto;
  display: block;
}
.svg-chart .chart-bar-rect {
  transition: opacity 0.15s;
}
.svg-chart g[data-action="stats-drilldown"]:hover .chart-bar-rect,
.svg-chart g[data-action="stats-drilldown"]:hover .chart-dot-circle {
  opacity: 1;
}
.svg-chart g[data-action="stats-drilldown"]:hover .chart-bar-rect {
  filter: brightness(1.12);
}
.svg-chart-value {
  font-size: 11px;
  font-weight: 600;
  fill: #475569;
}
.svg-chart-label {
  font-size: 10px;
  fill: #64748b;
}
.svg-chart-axis {
  font-size: 10px;
  fill: #94a3b8;
}
.chart-line-stroke {
  transition: stroke-width 0.15s;
}
.svg-chart g[data-action="stats-drilldown"]:hover .chart-line-stroke {
  stroke-width: 3;
}
.svg-pie-total {
  font-size: 18px;
  font-weight: 700;
  fill: #1e293b;
}
.svg-pie-label {
  font-size: 10px;
  fill: #94a3b8;
}
.pie-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.pie-chart-wrap {
  display: flex;
  justify-content: center;
}
.chart-legend {
  display: grid;
  gap: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.legend-item .legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-item .strong {
  margin-left: auto;
}

/* ===== Chart data table ===== */
.chart-table-wrap {
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}
.chart-table {
  font-size: 13px;
  min-width: 0;
  table-layout: fixed;
}
.chart-table th,
.chart-table td {
  padding: 6px 10px;
}
.chart-table tr[data-action="stats-drilldown"]:hover {
  background: #f1f5f9;
  cursor: pointer;
}
.ta-right {
  text-align: right;
}

/* ===== Chart card head actions ===== */
.card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head-actions select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

/* ===== Drilldown overlay ===== */
.drilldown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.drilldown-modal {
  background: #fff;
  border-radius: 8px;
  max-width: 960px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.drilldown-modal .card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drilldown-count {
  padding: 8px 20px;
  font-size: 13px;
  color: var(--muted);
}
.drilldown-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 20px 16px;
}

.drilldown-modal [data-drilldown-drag-handle] {
  cursor: move;
  touch-action: none;
  user-select: none;
}

.svg-chart [tabindex]:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

.news-history-modal .card-body {
  flex: 1;
  overflow: auto;
  padding: 8px 20px;
}

.news-history-modal .pager {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
}

@media (max-width: 640px) {
  .weather-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .drilldown-modal [data-drilldown-drag-handle] {
    cursor: default;
    touch-action: auto;
  }
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast-item {
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #0f172a;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.25);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.toast-item.error {
  background: #b91c1c;
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.desktop-hide {
  display: none;
}

@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-dashboard-layout,
  .home-summary-grid { grid-template-columns: 1fr; }
  .home-log-card { grid-column: auto; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.span-4 { grid-column: span 2; }
  .calc-preview { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-side {
    min-height: 280px;
    padding: 32px;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .desktop-hide {
    display: inline-flex;
  }
  .topbar {
    padding: 0 14px;
  }
  .page {
    padding: 16px;
  }
  .cols-2,
  .cols-3,
  .cols-4,
  .entry-stack,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .weather-port-row {
    grid-template-columns: 1fr;
  }
  .field.span-2,
  .field.span-4 {
    grid-column: span 1;
  }
  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .filters input,
  .filters select,
  .multi-filter {
    width: 100%;
  }
  .pager {
    align-items: flex-start;
    flex-direction: column;
  }
  .pager-actions {
    width: 100%;
  }
}
