/* ===== ozon小助手 replica · design tokens ===== */
:root {
  --bg-top: #363b45;
  --bg-side: #383d46;
  --bg-body: #3f444d;
  --bg-panel: #454a54;
  --bg-hover: #4a505b;
  --bg-input: #3a3f48;
  --border: #4a505a;
  --border-soft: #454a54;
  --text: #dfe3e8;
  --text-dim: #99a1ad;
  --text-weak: #7c848f;
  --green: #2fc2a5;
  --green-dark: #25a98f;
  --green-soft: rgba(47, 194, 165, 0.14);
  --red: #f56c6c;
  --orange: #e6a23c;
  --white: #ffffff;
  --ink: #515a6e;
  --radius: 4px;
  --sidebar-w: 200px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-body);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 13px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #565c67; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== LOGIN ===================== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #2c4a4f 0%, #23343b 45%, #1e2a30 100%);
  padding: 40px 16px;
}
.auth-card {
  width: 460px;
  max-width: 100%;
  background: #33373d;
  border-radius: 6px;
  padding: 30px 44px 26px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo svg { width: 62px; height: 62px; }
.auth-title { font-size: 19px; color: #e8eaee; margin: 6px 0 6px; letter-spacing: 2px; }
.auth-sub { font-size: 13px; color: #9aa1ac; letter-spacing: 1px; }
.field {
  display: flex;
  align-items: center;
  height: 44px;
  background: #2e3238;
  border: 1px solid #454a52;
  border-radius: 3px;
  padding: 0 12px;
  margin-bottom: 18px;
  transition: border-color 0.18s;
}
.field:focus-within { border-color: var(--green); }
.field svg { width: 15px; height: 15px; stroke: var(--green); flex: 0 0 15px; }
.field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #dfe3e8;
  padding-left: 10px;
  height: 100%;
}
.field input::placeholder { color: #8d95a2; }
.captcha-row { display: flex; gap: 13px; }
.captcha-row .field { flex: 0 0 56%; margin-bottom: 18px; }
.captcha-img {
  flex: 1;
  height: 44px;
  border-radius: 3px;
  background: linear-gradient(135deg, #3a3f47, #2b2f35);
  border: 1px solid #454a52;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.captcha-img svg { width: 100%; height: 100%; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: #a9b0ba; font-size: 13px; user-select: none; }
.checkbox i {
  width: 15px; height: 15px; border: 1px solid #6a717c; border-radius: 2px;
  display: inline-block; position: relative;
}
.checkbox input { display: none; }
.checkbox input:checked + i { background: var(--green); border-color: var(--green); }
.checkbox input:checked + i::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.btn {
  height: 40px; border: 0; border-radius: 3px; background: var(--green); color: #fff;
  cursor: pointer; padding: 0 18px; font-size: 14px; transition: background 0.18s;
}
.btn:hover { background: var(--green-dark); }
.btn-block { width: 100%; height: 44px; font-size: 16px; letter-spacing: 2px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-red { background: var(--red); }
.btn-red:hover { background: #e05555; }
.btn-sm { height: 32px; font-size: 13px; padding: 0 14px; }
.auth-foot { display: flex; justify-content: flex-end; margin-top: 18px; font-size: 13px; }
.copyright { margin-top: 40px; font-size: 12.5px; color: #6f7885; letter-spacing: 0.4px; }
.auth-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin: -8px 0 8px; }

/* ===================== APP SHELL ===================== */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  height: 88px; flex: 0 0 88px; background: var(--bg-top);
  display: flex; align-items: center; padding: 0 20px 0 0; gap: 10px;
  border-bottom: 1px solid #2f343d; position: relative; z-index: 20;
}
.brand { width: var(--sidebar-w); display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; }
.brand svg { width: 40px; height: 40px; }
.collapse-btn {
  width: 34px; height: 34px; border-radius: 3px; border: 0; background: transparent;
  color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.collapse-btn:hover { background: var(--bg-hover); color: #fff; }
.top-center { flex: 1; display: flex; justify-content: center; }
.validity {
  position: relative; height: 42px; padding: 0 20px; border: 1px solid var(--green);
  border-radius: 4px; display: flex; align-items: center; color: #e8eaee; font-size: 14px;
  background: rgba(47, 194, 165, 0.06);
}
.validity-tip {
  position: absolute; top: -13px; right: 14px; background: var(--green); color: #fff;
  font-size: 11px; padding: 2px 9px; border-radius: 9px; white-space: nowrap;
}
.top-right { display: flex; align-items: center; gap: 14px; color: var(--text-dim); }
.top-right .phone { font-size: 14px; letter-spacing: 0.5px; }
.icon-btn { width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 3px; }
.icon-btn:hover { background: var(--bg-hover); color: #fff; }

.body { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--bg-side);
  overflow-y: auto; overflow-x: hidden; transition: flex-basis 0.2s, width 0.2s;
}
.sidebar.collapsed { width: 64px; flex-basis: 64px; }
.sidebar.collapsed .menu-text, .sidebar.collapsed .menu-arrow { display: none; }
.sidebar.collapsed .menu-children { display: none !important; }
.menu-group { border-bottom: 1px solid #33373f; }
.menu-item {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px;
  color: #d3d8df; cursor: pointer; font-size: 15px; user-select: none; position: relative;
}
.menu-item:hover { background: #414650; }
.menu-item svg { width: 16px; height: 16px; stroke: #b9c0ca; flex: 0 0 16px; }
.menu-item.active { color: #fff; background: #414650; }
.menu-item.active svg { stroke: var(--green); }
.menu-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-arrow {
  width: 6px; height: 6px; flex: 0 0 6px; margin-right: 3px;
  border-right: 1px solid #8f96a1; border-bottom: 1px solid #8f96a1;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.2s;
}
.menu-group.open .menu-arrow { transform: rotate(225deg) translateY(-2px); }
.menu-children { display: none; background: #33373f; }
.menu-group.open .menu-children { display: block; }
.sub-item {
  display: block; height: 50px; line-height: 50px; padding-left: 42px; color: #c2c8d1;
  font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-item:hover { background: #414650; color: #fff; }
.sub-item.active { background: #414650; color: var(--green); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-body); }
.tags {
  height: 44px; flex: 0 0 44px; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; overflow-x: auto; background: var(--bg-body); border-bottom: 1px solid #383d46;
}
.tag {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px;
  background: var(--bg-top); color: #b7bec8; border-radius: 3px; font-size: 12.5px;
  white-space: nowrap; cursor: pointer; border: 1px solid transparent;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: #6b7280; }
.tag.active { color: var(--green); background: #4a505b; }
.tag.active .dot { background: var(--green); }
.tag .x { color: #8b929c; font-size: 12px; }
.tag .x:hover { color: #fff; }
.content { flex: 1; overflow: auto; padding: 18px 20px 28px; }

/* ===================== CARDS / PANELS ===================== */
.panel { background: var(--bg-body); border-radius: var(--radius); }
.card {
  background: var(--white); border-radius: var(--radius); color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.card-head {
  height: 54px; display: flex; align-items: center; padding: 0 22px;
  border-bottom: 1px solid #ebeef5; font-size: 15px; color: #303133;
}
.card-body { padding: 8px 22px 22px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.notice-row {
  display: flex; justify-content: space-between; align-items: center; padding: 15px 0;
  border-bottom: 1px solid #f0f2f5; font-size: 14px;
}
.notice-row:last-child { border-bottom: 0; }
.notice-row a { color: #3fae95; }
.notice-date { color: #909399; font-size: 13px; }
.perm-row { display: flex; padding: 12px 0; font-size: 14px; color: #606266; line-height: 1.7; }
.perm-row b { font-weight: 400; color: #303133; }

/* ===================== FILTER BAR / TOOLBAR ===================== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; margin-bottom: 14px; }
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item > label { font-size: 14px; color: #cfd4db; white-space: nowrap; font-weight: 500; }
.filter-item > label.req::before { content: "*"; color: var(--red); margin-right: 3px; }
.ctl {
  height: 34px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px;
  color: var(--text); padding: 0 10px; outline: none; min-width: 130px;
}
.ctl:focus { border-color: var(--green); }
.ctl::placeholder { color: #737b86; }
select.ctl { cursor: pointer; }
textarea.ctl { height: auto; padding: 8px 10px; min-height: 90px; resize: vertical; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.btn-outline-orange { background: transparent; border: 1px solid var(--orange); color: var(--orange); }
.btn-outline-orange:hover { background: rgba(230, 162, 60, 0.12); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: #cfd4db; }
.btn-outline:hover { background: var(--bg-hover); }
.link-btn { background: transparent; border: 0; color: var(--green); cursor: pointer; padding: 0 6px; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.red { color: var(--red); }

/* ===================== TABLE ===================== */
/* 表格自身作为滚动容器，表头才能 sticky 吸顶 */
.table-wrap {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: auto;
  max-height: max(320px, calc(100vh - 380px));
}
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; color: #d8dde3; }
table.grid th {
  background: #3a3f48; color: #e7eaee; font-weight: 500; text-align: left; padding: 12px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 #4a505a;
}
table.grid td { padding: 11px 12px; border-bottom: 1px solid #454a54; vertical-align: middle; }
table.grid tbody tr:hover { background: #454a54; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid .empty { text-align: center; color: var(--text-weak); padding: 60px 0; }
.cell-nowrap { white-space: nowrap; }
.cell-muted { color: var(--text-dim); font-size: 12.5px; }
.thumb { width: 46px; height: 46px; border-radius: 3px; object-fit: cover; background: #4a505a; display: block; }
.thumb-ph { width: 46px; height: 46px; border-radius: 3px; background: linear-gradient(135deg, #565c67, #454a54); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 3px; font-size: 12px; line-height: 18px;
  background: var(--green); color: #fff;
}
.badge.gray { background: #5b626d; }
.badge.orange { background: var(--orange); }
.badge.red { background: var(--red); }
.badge.blue { background: #409eff; }
.badge.plain { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.switch-text { color: var(--green); cursor: pointer; }
.switch-text.off { color: var(--text-weak); }
.checkbox-cell input { width: 15px; height: 15px; accent-color: var(--green); cursor: pointer; }

/* ===================== PAGINATION ===================== */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--text-dim); flex-wrap: wrap; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 3px; border: 1px solid transparent;
  background: transparent; color: #cfd4db; cursor: pointer;
}
.pager .pg:hover { color: var(--green); }
.pager .pg.active { color: var(--green); border-color: var(--green); }
.pager .pg:disabled { color: #666d78; cursor: not-allowed; }
.pager select { height: 30px; }

/* ===================== FORMS ===================== */
.form-panel { background: var(--bg-panel); border-radius: var(--radius); padding: 22px 24px; }
.form-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.form-row > label { flex: 0 0 130px; text-align: right; padding-top: 9px; color: #cfd4db; font-size: 14px; }
.form-row > label.req::before { content: "*"; color: var(--red); margin-right: 3px; }
.form-row .form-ctl { flex: 1; max-width: 520px; }
.form-row .hint { color: var(--text-weak); font-size: 12px; margin-top: 6px; }
.form-actions { padding-left: 142px; display: flex; gap: 12px; }

/* ===================== SPECIAL PAGES ===================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--bg-panel); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--border-soft); }
.stat-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; }
.stat-value { font-size: 24px; color: #fff; font-weight: 500; }
.stat-value small { font-size: 12px; color: var(--text-dim); margin-left: 6px; }
.stat-delta { font-size: 12px; margin-top: 8px; color: var(--green); }
.stat-delta.down { color: var(--red); }
.chart-panel { background: var(--bg-panel); border-radius: var(--radius); padding: 18px; border: 1px solid var(--border-soft); }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chart-head h3 { margin: 0; font-size: 15px; font-weight: 500; color: #e7eaee; }
canvas { width: 100%; display: block; }
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; height: calc(100vh - 210px); min-height: 460px; }
.chat-list { background: var(--bg-panel); border-radius: var(--radius); overflow-y: auto; border: 1px solid var(--border-soft); }
.chat-item { padding: 12px 14px; border-bottom: 1px solid #4a505a; cursor: pointer; }
.chat-item:hover { background: #4a505b; }
.chat-item.active { background: #4a505b; border-left: 3px solid var(--green); }
.chat-item .who { font-size: 13.5px; color: #e7eaee; display: flex; justify-content: space-between; }
.chat-item .who span { font-size: 11.5px; color: var(--text-weak); }
.chat-item .last { font-size: 12px; color: var(--text-dim); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { background: var(--bg-panel); border-radius: var(--radius); border: 1px solid var(--border-soft); display: flex; flex-direction: column; min-height: 0; }
.chat-main-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; color: #e7eaee; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 72%; padding: 9px 12px; border-radius: 6px; font-size: 13px; line-height: 1.6; }
.msg.them { background: #3a3f48; color: #dce1e7; align-self: flex-start; }
.msg.me { background: var(--green-soft); color: #cfeee6; align-self: flex-end; border: 1px solid rgba(47, 194, 165, 0.35); }
.chat-input { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.editor-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.editor-thumbs { background: var(--bg-panel); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border-soft); }
.editor-thumb { height: 96px; border-radius: 4px; background: linear-gradient(135deg, #565c67, #454a54); display: flex; align-items: center; justify-content: center; font-size: 12px; color: #aeb5bf; cursor: pointer; border: 1px solid transparent; }
.editor-thumb.active { border-color: var(--green); color: var(--green); }
.editor-canvas { background: #2f343d; border-radius: var(--radius); border: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: center; min-height: 380px; }
.editor-canvas .ph { color: var(--text-weak); font-size: 13px; }
.tips { color: var(--text-weak); font-size: 12.5px; line-height: 1.9; }
.sub-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.sub-tabs .tab-item { padding: 8px 2px; color: var(--text-dim); cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; }
.sub-tabs .tab-item.active { color: var(--green); border-bottom-color: var(--green); }
.plugin-card { display: flex; gap: 16px; align-items: flex-start; background: var(--bg-panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; }
.plugin-icon { width: 56px; height: 56px; border-radius: 10px; background: var(--green-soft); display: flex; align-items: center; justify-content: center; flex: 0 0 56px; }
.plugin-icon svg { width: 28px; height: 28px; stroke: var(--green); }
.plugin-card h3 { margin: 2px 0 8px; font-size: 15px; font-weight: 500; color: #e7eaee; }
.plugin-card p { margin: 0 0 12px; font-size: 13px; color: var(--text-dim); line-height: 1.75; }
.tagline { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 11.5px; background: var(--green-soft); color: var(--green); border: 1px solid rgba(47, 194, 165, 0.35); }
.track-result { background: var(--bg-panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; margin-top: 18px; }
.timeline { border-left: 2px solid #4a505a; margin-left: 6px; padding-left: 18px; }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before { content: ""; position: absolute; left: -25px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: #5b626d; }
.timeline-item.done::before { background: var(--green); }
.timeline-item .t { font-size: 13px; color: #dce1e7; }
.timeline-item .d { font-size: 12px; color: var(--text-weak); margin-top: 4px; }

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .auth-card { padding: 24px 22px; }
  .top-center { display: none; }
  .editor-layout, .chat-layout { grid-template-columns: minmax(0, 1fr); }
}
