:root {
  --ink: #17231d;
  --muted: #6f7b74;
  --line: #dfe6e2;
  --soft: #f4f7f5;
  --panel: #ffffff;
  --brand: #176848;
  --brand-dark: #0f4c35;
  --brand-soft: #e4f2eb;
  --orange: #b86420;
  --orange-soft: #fff2df;
  --red: #ad4f42;
  --red-soft: #fff0ed;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--soft); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(360px, .85fr);
  background:
    radial-gradient(circle at 12% 12%, rgba(112, 183, 149, .18), transparent 30%),
    linear-gradient(135deg, #eef5f1 0%, #dbe9e1 48%, #f7f8f7 48%);
}
.login-copy { align-self: center; max-width: 650px; padding: 70px 8vw; }
.brand-mark {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 16px; background: var(--brand); color: white;
  font-weight: 900; letter-spacing: -.04em; box-shadow: 0 16px 35px rgba(23, 104, 72, .22);
}
.eyebrow { margin: 30px 0 14px; color: var(--brand); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.login-copy h1 { margin: 0; font-size: clamp(38px, 5vw, 68px); line-height: 1.08; letter-spacing: -.055em; }
.login-lead { max-width: 500px; margin: 26px 0 36px; color: #54635b; font-size: 17px; line-height: 1.8; }
.safety-note {
  max-width: 520px; display: flex; gap: 14px; align-items: flex-start;
  padding: 18px; border: 1px solid rgba(23, 104, 72, .15); border-radius: 16px;
  background: rgba(255, 255, 255, .58);
}
.safety-note > span {
  padding: 6px 9px; border-radius: 8px; background: var(--brand-soft);
  color: var(--brand); font-size: 11px; font-weight: 900;
}
.safety-note p { margin: 1px 0 0; color: #59675f; font-size: 13px; line-height: 1.7; }
.login-card {
  align-self: center; width: min(430px, calc(100% - 48px)); margin: 48px auto;
  padding: 34px; border: 1px solid rgba(25, 61, 43, .1); border-radius: 24px;
  background: rgba(255, 255, 255, .93); box-shadow: 0 30px 80px rgba(28, 57, 43, .13);
}
.login-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-card-head > span {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-weight: 900;
}
.login-card h2 { margin: 0 0 5px; font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card label { display: grid; gap: 8px; margin: 18px 0; color: #445249; font-size: 13px; font-weight: 700; }
.login-card input {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid #d6dfda;
  border-radius: 12px; outline: none; background: #fbfcfb; color: var(--ink);
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.login-card button {
  width: 100%; height: 50px; margin-top: 7px; border: 0; border-radius: 13px;
  background: var(--brand); color: white; font-weight: 800;
}
.login-card button:disabled { opacity: .6; cursor: wait; }
.login-card > small { display: block; margin-top: 18px; color: #8b958f; font-size: 11px; line-height: 1.6; text-align: center; }
.icp-link { display: block; margin-top: 8px; color: #75847d; font-size: 10px; text-align: center; text-decoration: none; }
.form-error { min-height: 18px; color: var(--red) !important; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 14px; background: #12291f; color: white;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 9px 24px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand > span {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; background: #2c9670; font-weight: 900;
}
.sidebar-brand div { display: grid; gap: 4px; }
.sidebar-brand b { font-size: 14px; }
.sidebar-brand small { color: #86a294; font-size: 10px; }
.sidebar nav { display: grid; gap: 5px; padding-top: 19px; }
.nav-item {
  min-height: 45px; display: flex; align-items: center; gap: 11px; padding: 0 11px;
  border: 0; border-radius: 11px; background: transparent; color: #a9bdb2; text-align: left;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: white; }
.nav-item i {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 8px; background: rgba(255,255,255,.07); font-size: 11px; font-style: normal;
}
.sidebar-status {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 16px 10px 4px; border-top: 1px solid rgba(255,255,255,.09);
}
.sidebar-status .status-dot { width: 9px; height: 9px; border-radius: 50%; background: #64d79d; box-shadow: 0 0 0 4px rgba(100,215,157,.12); }
.sidebar-status div { display: grid; gap: 3px; }
.sidebar-status b { font-size: 11px; }
.sidebar-status small { color: #789487; font-size: 9px; }
.sidebar-icp { margin: 10px 10px 0; color: #789487; font-size: 9px; text-align: center; text-decoration: none; }
.workspace { min-width: 0; }
.topbar {
  min-height: 90px; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9);
}
.topbar p { margin: 0 0 5px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.account { display: flex; align-items: center; gap: 9px; }
.account > span {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 900;
}
.account div { display: grid; gap: 2px; }
.account b { font-size: 11px; }
.account small { color: var(--muted); font-size: 9px; }
.account button { margin-left: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: white; color: #5c6861; font-size: 10px; }
.content { padding: 27px 32px 48px; }
.loading, .empty, .error-card {
  min-height: 260px; display: grid; place-content: center; gap: 8px;
  border: 1px dashed #cdd8d2; border-radius: 18px; background: white; color: var(--muted); text-align: center;
}
.error-card { color: var(--red); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; }
.metric-card {
  min-height: 150px; padding: 19px; display: grid; align-content: start;
  border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 4px 16px rgba(21,48,34,.035);
}
.metric-card span { color: var(--muted); font-size: 11px; }
.metric-card b { margin: 19px 0 12px; font-size: 29px; letter-spacing: -.04em; }
.metric-card small { color: #758179; font-size: 10px; }
.metric-card em { width: fit-content; margin-top: 10px; padding: 5px 7px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-style: normal; }
.two-column { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 18px; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.panel-head, .page-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head { margin-bottom: 14px; }
.panel-head h2, .page-actions h2 { margin: 0 0 5px; font-size: 14px; }
.panel-head p, .page-actions p { margin: 0; color: var(--muted); font-size: 10px; }
.panel-head button, .primary-action {
  padding: 10px 13px; border: 0; border-radius: 10px; background: var(--brand); color: white; font-size: 10px; font-weight: 800;
}
.task-list { display: grid; }
.task-row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #edf1ef; }
.task-row:first-child { border-top: 0; }
.task-row > span { color: var(--brand); font-size: 10px; font-weight: 800; }
.task-row p { display: grid; gap: 4px; margin: 0; }
.task-row b { font-size: 11px; }
.task-row small { color: var(--muted); font-size: 9px; }
.status-pill { padding: 5px 7px; border-radius: 7px; background: #eef2f0; color: #68746d; font-size: 9px; font-style: normal; }
.status-pill.published, .status-pill.planned { background: var(--brand-soft); color: var(--brand); }
.status-pill.pending { background: var(--orange-soft); color: var(--orange); }
.status-pill.failed { background: var(--red-soft); color: var(--red); }
.mode-card { display: grid; align-content: center; min-height: 205px; background: linear-gradient(150deg, #173e2d, #0f2b20); color: white; }
.mode-card > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.1); font-weight: 900; }
.mode-card h2 { margin: 20px 0 8px; font-size: 20px; }
.mode-card p { margin: 0; color: #a8beb3; font-size: 11px; line-height: 1.7; }

.page-actions { margin-bottom: 16px; }
.page-actions-right { display: flex; gap: 8px; }
.secondary-action { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: #506057; font-size: 10px; }
.data-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.data-row {
  display: grid; grid-template-columns: minmax(230px, 1.7fr) .65fr 1fr 1fr .65fr .7fr;
  gap: 12px; align-items: center; min-height: 67px; padding: 10px 15px; border-top: 1px solid #edf1ef;
  color: #56635c; font-size: 10px;
}
.data-row:first-child { border-top: 0; }
.data-head { min-height: 39px; background: #f8faf9; color: #7e8983; font-size: 9px; font-weight: 800; }
.item-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-title > i {
  width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-style: normal; font-weight: 900;
}
.item-title p { min-width: 0; display: grid; gap: 4px; margin: 0; }
.item-title b, .data-row > span > b { overflow: hidden; color: #26352d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.item-title small { overflow: hidden; color: #89938d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.row-button { padding: 6px 8px; border: 1px solid #dbe3df; border-radius: 8px; background: white; color: #53625a; font-size: 9px; }
.row-button.danger { color: var(--red); }

.create-panel { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.create-panel h2 { margin: 0 0 16px; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: 1.2fr .7fr 1fr; gap: 10px; }
.form-grid label, .full-field { display: grid; gap: 6px; color: #536058; font-size: 10px; font-weight: 800; }
.form-grid input, .form-grid select, .full-field input, .full-field textarea {
  width: 100%; min-height: 41px; padding: 9px 11px; border: 1px solid #dbe3df; border-radius: 10px; outline: none; background: white; color: var(--ink);
}
.full-field { margin-top: 10px; }
.full-field textarea { min-height: 72px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .full-field input:focus, .full-field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-footer { display: flex; justify-content: flex-end; margin-top: 12px; }

.review-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.review-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.review-card > span { padding: 5px 8px; border-radius: 7px; background: var(--orange-soft); color: var(--orange); font-size: 9px; }
.review-card h2 { min-height: 42px; margin: 16px 0 12px; font-size: 14px; line-height: 1.5; }
.review-card dl { margin: 0; }
.review-card dl > div { display: grid; grid-template-columns: 54px 1fr; padding: 9px 0; border-top: 1px solid #edf1ef; font-size: 10px; }
.review-card dt { color: #89938d; }
.review-card dd { margin: 0; overflow-wrap: anywhere; color: #4f5d55; }
.review-card a { color: var(--brand); }
.review-actions { display: grid; grid-template-columns: .8fr 1.2fr; gap: 8px; margin-top: 14px; }
.review-actions button { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; color: #56645c; font-size: 10px; }
.review-actions button:last-child { border: 0; background: var(--brand); color: white; font-weight: 800; }

.confirm-dialog { width: min(410px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 20px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.24); }
.confirm-dialog::backdrop { background: rgba(10, 24, 17, .56); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 25px; text-align: center; }
.confirm-icon { width: 44px; height: 44px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--orange-soft); color: var(--orange); font-weight: 900; }
.confirm-dialog h2 { margin: 14px 0 9px; font-size: 18px; }
.confirm-dialog p { margin: 0; color: #657169; font-size: 12px; line-height: 1.7; }
.confirm-dialog form > div { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-top: 20px; }
.confirm-dialog button { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: white; color: #536058; }
.confirm-dialog button:last-child { border: 0; background: var(--brand); color: white; font-weight: 800; }
.confirm-dialog small { display: block; margin-top: 12px; color: #939c97; font-size: 9px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 16px; border-radius: 11px; background: #15241c; color: white; box-shadow: 0 15px 35px rgba(0,0,0,.2); font-size: 11px; }

@media (max-width: 980px) {
  .login-page { grid-template-columns: 1fr; }
  .login-copy { padding-bottom: 10px; }
  .login-card { margin-top: 24px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: repeat(2, 1fr); }
  .data-card { overflow-x: auto; }
  .data-row { min-width: 880px; }
}

@media (max-width: 700px) {
  .admin-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding-bottom: 10px; }
  .sidebar nav { grid-template-columns: repeat(5, minmax(80px,1fr)); overflow-x: auto; }
  .nav-item { justify-content: center; padding: 0 8px; }
  .nav-item i, .sidebar-status { display: none; }
  .topbar { padding: 16px 18px; }
  .account div { display: none; }
  .content { padding: 20px 16px 36px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-copy { padding: 42px 24px 14px; }
  .login-card { padding: 26px; }
}
