/* i-NYS 售后管理系统 v2.1 — 设计系统 */
:root {
  --brand-1: #6a5af9;
  --brand-2: #4f8ef7;
  --accent: #5b6cf5;
  --accent-soft: #eef0ff;
  --ink: #1f2937;
  --text: #1f2937;
  --text-soft: #4b5563;
  --muted: #9aa3b2;
  --line: #eef0f4;
  --line-strong: #e5e8ee;
  --panel-bg: #f7f8fc;
  --surface: #ffffff;
  --tone-blue-bg: #eef0ff;  --tone-blue: #5b6cf5;
  --tone-emerald-bg: #e9f9f0; --tone-emerald: #16a374;
  --tone-amber-bg: #fff5e6;  --tone-amber: #d97c0b;
  --tone-rose-bg: #fdeef0;   --tone-rose: #e5484d;
  --tone-slate-bg: #f1f3f7;  --tone-slate: #64748b;
  --success: #22c55e;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --shadow-xs: 0 1px 2px rgba(31,41,55,.05);
  --shadow-sm: 0 2px 6px rgba(31,41,55,.05), 0 10px 30px -12px rgba(31,41,55,.10);
  --shadow-md: 0 4px 10px rgba(31,41,55,.05), 0 18px 44px -16px rgba(31,41,55,.18);
  --shadow-float: 0 24px 60px -20px rgba(58,64,132,.35);
  --input-bg: #ffffff;
  --surface-2: #f4f6fb;
  --hover-bg: rgba(91,108,245,.06);
  --empty-bg: #fafbfe;
  --ring-track: #e8ebf3;
  --link: var(--accent);
}

[data-theme='dark'] {
  color-scheme: dark;
  --ink: #e8eaf0;
  --text: #e8eaf0;
  --text-soft: #b6bccb;
  --muted: #8a93a6;
  --line: #2b3040;
  --line-strong: #363c4e;
  --panel-bg: #141824;
  --surface: #1b1f2c;
  --accent-soft: #262b3d;
  --tone-blue-bg: #232a44;  --tone-blue: #8ea2ff;
  --tone-emerald-bg: #1c3a30; --tone-emerald: #4bd6a4;
  --tone-amber-bg: #3d2f18;  --tone-amber: #f0a83c;
  --tone-rose-bg: #3d2226;   --tone-rose: #f2707a;
  --tone-slate-bg: #262b38;  --tone-slate: #9aa5b8;
  --input-bg: #161b27;
  --surface-2: #222837;
  --hover-bg: rgba(255,255,255,.05);
  --empty-bg: #171c28;
  --ring-track: #2a3040;
  --link: #8ea2ff;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
*,*::before,*::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 8% 8%, rgba(122,90,248,.55), transparent 55%),
    radial-gradient(1000px 600px at 90% 90%, rgba(79,142,247,.45), transparent 55%),
    linear-gradient(150deg, #8b7cf8 0%, #6a7ff5 45%, #558df5 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter","Segoe UI","PingFang SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[data-theme='dark'] body {
  background:
    radial-gradient(900px 500px at 8% 8%, rgba(76,52,160,.55), transparent 55%),
    radial-gradient(1000px 600px at 90% 90%, rgba(37,74,140,.45), transparent 55%),
    linear-gradient(150deg, #171a2b 0%, #141826 45%, #101524 100%);
  background-attachment: fixed;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt-8 { margin-top: 8px; } .mt-10 { margin-top: 10px; } .mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; }
.mono { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size: .92em; }
.fs-12 { font-size: 12.5px; }
.fs-13 { font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.panel-narrow { max-width: 520px; }
.modal-narrow { max-width: 420px; }
.w-220 { width: 220px; }
.col-110 { width: 110px; }
.col-140 { width: 140px; }
.col-170 { width: 170px; }
.col-210 { width: 210px; }
.btn-logout { color: rgba(255,255,255,.75); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.btn-logout:hover { background: rgba(255,255,255,.18); color: #fff; }

/* 细线图标 */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ── 登录视图 ───────────────────────────────────── */
#view-login { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.login-wrap { width: 100%; max-width: 410px; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 46px 40px;
  box-shadow: var(--shadow-float);
  text-align: center;
}
[data-theme='dark'] .login-card { background: var(--surface); }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 22px;
  box-shadow: var(--shadow-md);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-sub { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.login-hint { margin: 18px 0 0; font-size: 12px; color: var(--muted); }

/* ── 应用外壳：侧边栏 + 主区（满屏铺边） ─────────── */
#view-app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 216px; flex: none;
  background: linear-gradient(170deg, #2c2a63 0%, #2a3a72 55%, #26456f 100%);
  color: #fff;
  display: flex; flex-direction: column;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100dvh;
}
[data-theme='dark'] .sidebar { background: linear-gradient(170deg, #232148 0%, #213058 55%, #1d3556 100%); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.sidebar-brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.sidebar-brand b { font-size: 15px; letter-spacing: .5px; }
.sidebar-brand span { display: block; font-size: 11px; opacity: .65; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; opacity: .55; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: rgba(255,255,255,.72); text-decoration: none; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 500; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.theme-toggle { display: flex; align-items: center; gap: 6px; }
.theme-btn {
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #fff;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.theme-btn:hover { background: rgba(255,255,255,.16); }
.theme-divider { flex: 1; }

.main { flex: 1; min-width: 0; background: var(--panel-bg); display: flex; flex-direction: column; }
[data-theme='dark'] .main { background: var(--panel-bg); }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.user-meta { line-height: 1.25; }
.user-meta b { font-size: 13px; display: block; }
.user-meta span { font-size: 11px; color: var(--muted); }

/* 页面容器 */
.page { padding: 22px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }

/* 面板 */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head .spacer { flex: 1; }

/* 页签 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: none; background: none; cursor: pointer;
  padding: 8px 14px; font-size: 13.5px; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* 表格 */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-soft); font-weight: 500; font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--hover-bg); }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
label { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 5px; }
label .req { color: var(--tone-rose); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--input-bg); color: var(--text); font-size: 13.5px; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 76px; resize: vertical; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }
.chk-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* 按钮 */
.btn-primary, .btn-soft, .btn-ghost, .btn-mini {
  border-radius: 10px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: filter .12s, background .12s, border-color .12s;
  white-space: nowrap;
}
.btn-primary { border: none; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; padding: 9px 16px; font-weight: 500; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-soft { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 8px 14px; }
.btn-soft:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { border: none; background: none; color: var(--accent); padding: 8px 10px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-mini { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-soft); padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }
.btn-mini.danger:hover { border-color: var(--tone-rose); color: var(--tone-rose); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 1.7;
  background: var(--tone-slate-bg); color: var(--tone-slate);
  white-space: nowrap;
}
.tag-info { background: var(--tone-blue-bg); color: var(--tone-blue); }
.tag-success { background: var(--tone-emerald-bg); color: var(--tone-emerald); }
.tag-warning { background: var(--tone-amber-bg); color: var(--tone-amber); }
.tag-danger { background: var(--tone-rose-bg); color: var(--tone-rose); }
.tag-muted { background: var(--tone-slate-bg); color: var(--tone-slate); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* 空态 */
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--empty-bg);
  padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

/* 进度条 */
.progress { height: 7px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(23,26,43,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 560px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
}
.modal-wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-x {
  border: none; background: var(--surface-2); color: var(--text-soft);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-x:hover { background: var(--tone-rose-bg); color: var(--tone-rose); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-actions { padding: 0 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* 行内表单（一行一字段） */
.row-form { display: flex; flex-direction: column; gap: 14px; }
.row-item { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.row-item > label { margin-bottom: 0; }
.row-main b { font-size: 13.5px; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rows { display: flex; flex-direction: column; gap: 8px; }

/* 提示 */
.err {
  background: var(--tone-rose-bg); color: var(--tone-rose);
  border-radius: 10px; padding: 9px 13px; font-size: 12.5px; margin-top: 10px;
}
.warn-text { color: var(--tone-amber); font-size: 12.5px; }

/* 搜索 */
.search { position: relative; }
.search input { padding-left: 34px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* 通知铃铛（Phase 2 启用） */
.notify-btn { position: relative; border: none; background: var(--surface-2); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-soft); }
.notify-btn:hover { color: var(--accent); }
.notify-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--tone-rose); color: #fff;
  font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notify-panel {
  position: absolute; top: 44px; right: 0; z-index: 50; width: 340px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.notify-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 13.5px; }
.notify-head .spacer { flex: 1; }
.notify-list { max-height: 380px; overflow-y: auto; }
.notify-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.notify-item.unread { background: var(--accent-soft); }
.notify-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }
.notify-title { font-weight: 500; margin-bottom: 1px; }
.notify-detail { color: var(--text-soft); }
.notify-body { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }
.notify-filters { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* 响应式：窄屏侧边栏收为顶部横条 */
@media (max-width: 860px) {
  #view-app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; }
  .sidebar-brand { padding: 0 10px 0 0; }
  .nav { flex-direction: row; flex: 1; }
  .nav-group { display: none; }
  .sidebar-foot { border-top: none; padding-top: 0; }
  .page { padding: 14px; }
  .row-item { grid-template-columns: 1fr; gap: 4px; }
}
