/* 算数·诚速寄修 — 对齐算数·财税视觉（提夫尼青绿） */
:root {
  --bg: #eef6f5;
  --bg-alt: #dff0ee;
  --surface: #ffffff;
  --ink: #102826;
  --ink-2: #1a3a37;
  --muted: #3d5a56;
  --fog: #254540;
  --line: #b8d4d0;
  --line-soft: #d4e8e5;
  --accent: #0abab5;
  --accent-deep: #067a76;
  --accent-soft: rgba(10, 186, 181, .14);
  --brand: #0a6b5f;
  --ok: #0d8a5f;
  --warn: #c45c2a;
  --danger: #b42318;
  --display: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --shadow: 0 12px 28px rgba(16, 40, 38, .08);
  --shadow-sm: 0 2px 8px rgba(16, 40, 38, .05);
  --aside: #0d3d38;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  line-height: 1.65;
  background:
    radial-gradient(ellipse 90% 55% at 8% -8%, rgba(10, 186, 181, .16), transparent 52%),
    radial-gradient(ellipse 55% 45% at 96% 4%, rgba(6, 122, 118, .1), transparent 48%),
    linear-gradient(180deg, #f4fbfa 0%, var(--bg) 40%, #e8f4f2 100%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* —— 登录分栏：固定一屏，表单+角色同页可见 —— */
.portal-body {
  background: #0b2422;
  height: 100%;
  overflow: hidden;
}
html:has(.portal-body),
html:has(.portal-body) body {
  height: 100%;
  overflow: hidden;
}
.login-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
  background: #0b2422;
}
.login-left {
  position: relative; z-index: 2;
  min-height: 0;
  padding: clamp(16px, 3.2vh, 40px) clamp(20px, 3.5vw, 44px);
  background: linear-gradient(165deg, #ffffff 0%, #f3fbfa 55%, #e8f5f3 100%);
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: 12px 0 40px rgba(8, 32, 30, .12);
  overflow: auto;
}
.login-brand-block { margin-bottom: clamp(.7rem, 2vh, 1.35rem); animation: loginFadeUp .55s ease both; }
.login-eyebrow {
  margin: 0 0 .4rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .18em; color: var(--accent-deep);
}
.login-brand {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.55rem, 3.4vw, 2.35rem); font-weight: 900;
  letter-spacing: .02em; line-height: 1.15; color: var(--ink);
}
.login-lead {
  margin: .45rem 0 0; max-width: 28rem;
  color: var(--muted); font-size: clamp(.82rem, 1.5vh, .92rem); line-height: 1.5;
}
.login-form { animation: loginFadeUp .55s .08s ease both; flex-shrink: 0; }
.login-form label {
  display: block; margin: 0 0 4px;
  color: var(--fog); font-size: .78rem; font-weight: 700;
}
.login-form input, .login-form select {
  width: 100%; margin-bottom: clamp(8px, 1.4vh, 12px); border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: clamp(8px, 1.2vh, 11px) 12px; transition: border-color .2s, box-shadow .2s;
}
.login-form input:focus, .login-form select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn-gold, .login-submit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; border: none; cursor: pointer; margin-top: 2px;
  min-height: clamp(2.2rem, 4.5vh, 2.55rem); padding: .7rem 1rem; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 800;
  letter-spacing: .12em;
  box-shadow: 0 6px 16px rgba(10, 122, 114, .22);
  transition: transform .2s, background .2s;
}
.btn-gold:hover, .login-submit:hover { background: var(--accent-deep); transform: translateY(-1px); }
.login-links {
  margin-top: clamp(.7rem, 1.8vh, 1.1rem); color: var(--muted); font-size: .82rem;
  animation: loginFadeUp .55s .14s ease both;
}
.login-links a { color: var(--accent-deep); font-weight: 700; }
.login-links span { margin: 0 .35rem; opacity: .45; }
.login-msg { margin-top: 8px; }

.login-right {
  position: relative; overflow: hidden; min-height: 0;
  padding: clamp(14px, 2.8vh, 36px) clamp(16px, 3vw, 40px);
  color: #e8f4f2;
  background:
    radial-gradient(ellipse 70% 55% at 85% 10%, rgba(10, 186, 181, .28), transparent 55%),
    radial-gradient(ellipse 50% 45% at 10% 90%, rgba(6, 122, 118, .22), transparent 50%),
    linear-gradient(145deg, #0e2f2c 0%, #123d39 42%, #0a221f 100%);
  display: flex; flex-direction: column;
}
.login-right::before {
  content: ""; position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image:
    linear-gradient(rgba(232, 244, 242, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 244, 242, .05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
}
.login-right-inner {
  position: relative; z-index: 1; width: 100%; max-width: 760px; margin: 0 auto;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
}
.login-right-head { margin-bottom: clamp(.55rem, 1.6vh, 1.1rem); flex-shrink: 0; animation: loginFadeUp .55s .1s ease both; }
.login-right-head h2 {
  margin: 0 0 .35rem; font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.75rem); font-weight: 800;
  letter-spacing: .04em; color: #f3fbfa;
}
.login-right-head p { margin: 0; color: rgba(232, 244, 242, .72); font-size: clamp(.78rem, 1.4vh, .9rem); }
.login-right-head code {
  font-family: ui-monospace, Consolas, monospace; font-size: .86em;
  padding: .1em .35em; border-radius: 4px;
  background: rgba(10, 186, 181, .18); color: #9aefe9;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.2vh, 12px);
  min-height: 0;
  align-content: center;
}
.role-card {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: .12rem;
  min-height: 0;
  padding: clamp(.55rem, 1.2vh, .85rem) clamp(.65rem, 1vw, .9rem);
  border-radius: 12px;
  border: 1px solid rgba(184, 212, 208, .22);
  background: rgba(255, 255, 255, .06); color: inherit;
  backdrop-filter: blur(8px);
  transition: border-color .22s, background .22s, transform .22s, box-shadow .22s;
  animation: loginFadeUp .5s ease both; animation-delay: var(--delay, 0ms);
}
.role-card:hover {
  border-color: rgba(10, 186, 181, .55);
  background: rgba(10, 186, 181, .12); transform: translateY(-2px);
}
.role-card.is-selected {
  border-color: var(--accent);
  background: rgba(10, 186, 181, .2);
  box-shadow: inset 0 0 0 1px rgba(10, 186, 181, .35);
}
.role-card-tag { font-size: .65rem; font-weight: 800; letter-spacing: .12em; color: #7adcd6; }
.role-card-title { margin: .05rem 0 0; font-size: clamp(.92rem, 1.6vh, 1.05rem); font-weight: 800; color: #f7fcfb; }
.role-card-user { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; color: rgba(232,244,242,.55); }
.role-card-desc { margin-top: .2rem; font-size: .75rem; color: rgba(232,244,242,.7); line-height: 1.35; }
.login-right-foot {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: clamp(.7rem, 1.8vh, 1.25rem); padding-top: clamp(.55rem, 1.4vh, 1rem);
  border-top: 1px solid rgba(184, 212, 208, .18);
  flex-shrink: 0;
}
.login-foot-item em {
  font-style: normal; font-size: .68rem; font-weight: 800;
  letter-spacing: .1em; color: var(--accent); display: block; margin-bottom: .2rem;
}
.login-foot-item span { font-size: .78rem; color: rgba(232,244,242,.62); }
@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— 应用壳（侧栏） —— */
.shell { display: flex; min-height: 100vh; }
.aside {
  width: 232px; background: var(--aside); color: #fff;
  padding: 18px 12px; flex-shrink: 0; display: flex; flex-direction: column;
}
.aside .brand-block {
  display: flex; gap: 12px; align-items: center; padding: 8px 10px 22px;
}
.aside .mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #0abab5, #0a6b5f);
  display: grid; place-items: center; font-weight: 800; flex-shrink: 0;
}
.aside .brand-block strong { display: block; font-size: 15px; }
.aside .brand-block p { margin: 4px 0 0; opacity: .7; font-size: 12px; }
.menu { overflow-y: auto; flex: 1; padding-right: 2px; }
.menu .menu-label {
  display: block; padding: 12px 12px 4px; font-size: 11px;
  color: rgba(255,255,255,.45); letter-spacing: .06em; text-transform: uppercase;
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px; border: none;
  background: transparent; color: rgba(255,255,255,.82);
  margin-bottom: 1px; font-size: 13px; cursor: pointer;
}
.menu a.active, .menu a:hover, .menu button.active, .menu button:hover {
  background: rgba(255,255,255,.1); color: #fff;
}
.aside-foot { margin-top: auto; padding: 12px 10px 4px; font-size: 12px; color: rgba(255,255,255,.55); }
.aside { max-height: 100vh; overflow: hidden; }
.badge-dot {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: #e8b84a; color: #1a2e2c; font-size: 11px; font-weight: 700;
  text-align: center;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs .btn.active { background: var(--accent); color: #fff; border-color: transparent; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.print-sheet { max-width: 420px; margin: 24px auto; background: #fff; padding: 20px; border: 1px dashed #999; }
@media print {
  .no-print { display: none !important; }
  .site-wm, .aside, .header { display: none !important; }
  body { background: #fff; }
}

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.header h2 { margin: 0; font-size: 1rem; font-weight: 800; }
.header .sub { color: var(--muted); font-size: .82rem; }
.content { padding: 18px 20px 28px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-sm); padding: 16px;
}
.grid { display: grid; gap: 12px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 14px; }
.stat strong { display: block; font-size: 1.35rem; color: var(--ink); }
.stat span { color: var(--muted); font-size: .82rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab, .btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 8px 14px; color: var(--ink); font-weight: 600; font-size: .88rem;
}
.tab.active, .btn.primary {
  background: var(--accent); color: #fff; border-color: transparent;
}
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
label { display: grid; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--fog); }
.form { display: grid; gap: 10px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: .78rem; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep); font-size: .75rem; font-weight: 700;
}
.badge.warn { background: #fff1e8; color: var(--warn); }
.badge.ok { background: #e8f7ee; color: var(--ok); }
.badge.danger { background: #fdecea; color: var(--danger); }
tr.row-overdue { background: #fdecea !important; }
tr.row-overdue td { color: #8a1f1a; }
.text-danger { color: var(--danger); font-weight: 700; }
.msg { padding: 10px 12px; border-radius: 10px; background: #e8f7ee; color: var(--ok); font-size: .9rem; }
.msg.err { background: #fdecea; color: var(--danger); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px; font-size: .92rem; }
.kv b { color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); font-size: .86rem; }

.row-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: #e8f4f2; vertical-align: middle;
}
.row-thumb.lg { width: 56px; height: 56px; }
.media-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
}
.media-thumb {
  position: relative; display: block; width: 88px; height: 88px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  background: #0d3d38;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .68rem; text-align: center; color: #fff;
  background: rgba(8,32,30,.65); padding: 2px 0;
}
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-top: 10px;
}
.product-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  background: #f7fbfa;
}
.product-card img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px;
  background: #0d3d38;
}

.form-modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 24, 22, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.form-modal__panel {
  width: min(520px, 100%); max-height: 90vh; overflow: auto;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.gate-card {
  width: min(480px, 100%); margin: 10vh auto; padding: 28px;
}
.gate-card .login-brand { font-size: 1.75rem; }

@media (max-width: 960px) {
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .login-left {
    box-shadow: none;
    justify-content: flex-start;
    padding-bottom: 12px;
    overflow: visible;
  }
  .login-right {
    min-height: 0;
    overflow: hidden;
  }
  .login-right-inner {
    justify-content: flex-start;
    overflow: auto;
  }
  .role-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-right-foot { display: none; }
  .shell { flex-direction: column; }
  .aside { width: 100%; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .login-lead { display: none; }
  .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 720px) {
  .login-right-foot { display: none; }
  .login-lead { display: none; }
  .role-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-height: 640px) and (min-width: 961px) {
  .role-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .role-card-desc { display: none; }
}
