/* ============================================================
   Sociadock 控制台
   与官网同一套色板：深海军蓝底 + 青绿强调
   ============================================================ */

:root {
  --ink-950: #040911;
  --ink-900: #060F1D;
  --ink-850: #081422;
  --ink-800: #0A1A30;
  --ink-750: #0C2140;

  --line: rgba(255, 255, 255, 0.085);
  --line-2: rgba(255, 255, 255, 0.14);

  --text: #E8EFFA;
  --text-2: #A6B6CD;
  --text-3: #71849E;

  --accent: #2DD4BF;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-line: rgba(45, 212, 191, 0.34);

  --ok: #34D399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.13);
  --info: #60A5FA;
  --info-soft: rgba(96, 165, 250, 0.13);

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;

  --side: 232px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* 关键：自定义 display 会盖掉 hidden，必须显式压回去 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink-900);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

.muted { color: var(--text-3); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 0.94em; }

/* ---------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--accent-line); color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #2DD4BF, #14B8A6);
  border-color: transparent;
  color: #04211D;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(135deg, #4EE3D0, #1CC5B2); color: #04211D; }

.btn-quiet { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn-quiet:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); border-color: var(--line-2); }

.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); background: var(--danger-soft); }
.btn-danger:hover { color: #FCA5A5; border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.2); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* ---------------------------------------------------------- 登录 */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-aside {
  position: relative;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(ellipse 90% 70% at 20% 15%, rgba(45, 212, 191, 0.14), transparent 62%),
    linear-gradient(160deg, #0A1A30, #050B15);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.login-aside::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 30% 20%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 30% 20%, #000, transparent 75%);
  pointer-events: none;
}

.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 46px;
}
.login-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.login-brand strong { font-size: 17px; }
.login-brand em { font-style: normal; font-size: 11px; color: var(--text-3); letter-spacing: 0.05em; }

.login-aside h1 {
  position: relative;
  font-size: 32px;
  line-height: 1.28;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}

.login-aside > p {
  position: relative;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.78;
  max-width: 400px;
  margin-bottom: 30px;
}

.login-points {
  position: relative;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-width: 400px;
}
.login-points li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}
.login-points li::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 7px;
  width: 9px;
  height: 5px;
  border-left: 1.7px solid var(--accent);
  border-bottom: 1.7px solid var(--accent);
  transform: rotate(-45deg);
}

.login-back {
  position: relative;
  font-size: 12.5px;
  color: var(--text-3);
}
.login-back:hover { color: var(--accent); }

.login-main {
  display: grid;
  place-items: center;
  padding: 40px 32px;
  background: var(--ink-900);
}

.login-card {
  width: 100%;
  max-width: 356px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-card h2 { font-size: 22px; letter-spacing: -0.02em; }
.login-card > p.muted { margin-top: -10px; }

label { display: flex; flex-direction: column; gap: 7px; }
label > span { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 8l3-3.5' fill='none' stroke='%2371849E' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}
select option { background: #0A1A30; color: var(--text); }
textarea { resize: vertical; min-height: 72px; line-height: 1.6; }

.form-error {
  font-size: 12.5px;
  color: var(--danger);
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.24);
}

/* ---------------------------------------------------------- 应用骨架 */

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: var(--ink-950);
  border-right: 1px solid var(--line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav-item svg { flex-shrink: 0; opacity: 0.72; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.is-active svg { opacity: 1; }

.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.who { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.who div { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.who strong { font-size: 12.5px; font-weight: 600; }
.who em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------- 主区 */

.main {
  min-width: 0;
  padding: 26px 32px 56px;
  max-width: 1420px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 21px; letter-spacing: -0.02em; }
.topbar p { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.view-note {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  margin-bottom: 16px;
  max-width: 900px;
}

/* 统计卡 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.006));
}
.stat-card .stat-label { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.02em; }
.stat-card .stat-value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-top: 5px;
}
.stat-card .stat-foot { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.stat-card.is-warn { border-color: rgba(251, 191, 36, 0.26); background: linear-gradient(170deg, rgba(251, 191, 36, 0.08), rgba(255,255,255,0.006)); }
.stat-card.is-warn .stat-value { color: var(--warn); }
.stat-card.is-accent { border-color: var(--accent-line); background: linear-gradient(170deg, rgba(45, 212, 191, 0.09), rgba(255,255,255,0.006)); }
.stat-card.is-accent .stat-value { color: var(--accent); }

/* 面板 */

.panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  overflow: hidden;
  margin-bottom: 18px;
}
.panel-flush { padding: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 13.5px; font-weight: 600; }
.panel-hint { font-size: 11.5px; color: var(--text-3); }

/* 表格 */

.tbl-wrap { overflow-x: auto; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
table.tbl th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}
table.tbl td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text-2);
  vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background 0.14s ease; }
table.tbl tbody tr:hover { background: rgba(45, 212, 191, 0.035); }
table.tbl tbody tr.is-clickable { cursor: pointer; }
table.tbl .cell-strong { color: var(--text); font-weight: 600; }
table.tbl .cell-sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
table.tbl .cell-num { font-family: var(--mono); font-size: 12.5px; }
table.tbl .cell-right { text-align: right; white-space: nowrap; }
table.tbl .cell-actions { text-align: right; white-space: nowrap; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* 徽章 */

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-ok { color: #6EE7B7; background: var(--ok-soft); }
.badge-warn { color: #FCD34D; background: var(--warn-soft); }
.badge-danger { color: #FCA5A5; background: var(--danger-soft); }
.badge-info { color: #93C5FD; background: var(--info-soft); }
.badge-mute { color: var(--text-3); background: rgba(255, 255, 255, 0.07); }

/* 工具栏 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.field-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 0 1 320px;
}
.field-search svg { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.field-search input { padding-left: 33px; }
.toolbar select { width: auto; min-width: 126px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}
.pager-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------- 抽屉 */

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 12, 0.62);
  backdrop-filter: blur(3px);
  z-index: 90;
  animation: fade 0.18s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 92vw);
  z-index: 91;
  display: flex;
  flex-direction: column;
  background: var(--ink-850);
  border-left: 1px solid var(--line-2);
  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.5);
  animation: slide 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
}

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0.4; } }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.drawer-head h2 { font-size: 16.5px; }
.drawer-head p { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 抽屉内分节 */

.form-section { display: flex; flex-direction: column; gap: 13px; }
.form-section > h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-inline { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.hint-inline { font-size: 11.5px; color: var(--text-3); }

/* 详情里的紧凑列表 */

.mini-list { display: flex; flex-direction: column; gap: 7px; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.024);
  font-size: 12.5px;
}
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.mini-row em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-empty {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 12px 0;
}

/* 进度条 */

.meter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.meter-bar {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  min-width: 60px;
}
.meter-bar b { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.meter-bar b.is-warn { background: var(--warn); }
.meter-text { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(10, 26, 48, 0.96);
  border: 1px solid var(--line-2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  animation: fade 0.18s ease;
  max-width: 88vw;
}
.toast.is-error { border-color: rgba(248, 113, 113, 0.4); color: #FCA5A5; }
.toast.is-ok { border-color: var(--accent-line); color: var(--accent); }

/* 表格内联编辑控件 */

.cell-input {
  width: 100%;
  min-width: 62px;
  padding: 5px 8px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
}
.cell-input:hover { border-color: var(--line-2); }
.cell-input:focus { outline: none; border-color: var(--accent-line); background: rgba(255, 255, 255, 0.07); }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  width: 30px;
  height: 17px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background 0.16s ease;
  flex-shrink: 0;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(13px); }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 24px 22px 48px; }
}

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-main { min-height: 100vh; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-brand { padding: 0 8px 0 0; flex-shrink: 0; }
  .side-nav { flex-direction: row; gap: 4px; }
  .nav-item { padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
  .nav-item svg { display: none; }
  .side-foot { margin-top: 0; margin-left: auto; padding-top: 0; border-top: 0; flex-shrink: 0; }
  .who { display: none; }
  .main { padding: 18px 16px 44px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .field-search { flex: 1 1 auto; }
}
