/* 物上饮统一 Web 界面基线 V1.0 —— 统一设计 Token（deep 宇宙蓝 + 冷调蓝白 + 玻璃质感） */
:root {
  --wsy-bg-deep: #07111F;
  --wsy-bg-secondary: #0B1730;
  --wsy-surface-dark: rgba(17, 34, 64, 0.72);
  --wsy-surface-light: rgba(232, 243, 255, 0.82);
  --wsy-primary: #4EA1FF;
  --wsy-primary-hover: #6BB8FF;
  --wsy-indigo: #5B6CFF;
  --wsy-violet: #7A6CF6;
  --wsy-text-primary: #F4F8FF;
  --wsy-text-secondary: #AFC4E4;
  --wsy-text-dark: #14233A;
  --wsy-border: rgba(130, 180, 255, 0.22);
  --wsy-radius-sm: 8px;
  --wsy-radius-md: 12px;
  --wsy-radius-lg: 18px;
  --wsy-shadow-float: 0 12px 32px rgba(0, 20, 55, 0.24);
  --wsy-shadow-soft: 0 6px 20px rgba(0, 20, 55, 0.16);
  --wsy-danger: #FF6B7A;
  --wsy-warn: #F2C14E;
  --wsy-ok: #3ECFB2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(91,108,255,.18), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(78,161,255,.12), transparent 60%),
    var(--wsy-bg-deep);
  color: var(--wsy-text-primary);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 15px;
}

button { font: inherit; cursor: pointer; }
a { color: var(--wsy-primary); text-decoration: none; }
.hidden { display: none !important; }

/* ── 按钮语义 ── */
.btn {
  border: 1px solid var(--wsy-border);
  background: rgba(78,161,255,.12);
  color: var(--wsy-text-primary);
  border-radius: var(--wsy-radius-sm);
  padding: 8px 14px;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: rgba(107,184,255,.22); transform: translateY(-1px); box-shadow: var(--wsy-shadow-soft); }
.btn-primary { background: linear-gradient(135deg, rgba(78,161,255,.85), rgba(91,108,255,.85)); border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, rgba(107,184,255,.95), rgba(122,108,246,.9)); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(255,107,122,.14); border-color: rgba(255,107,122,.4); color: #FFD3D9; }
.btn-danger:hover { background: rgba(255,107,122,.26); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ── 登录页（左 40% 表单 / 右 60% 品牌视觉） ── */
#login-view { display: flex; min-height: 100vh; }
.login-panel {
  flex: 0 0 40%; min-width: 320px; display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--wsy-surface-dark);
  border: 1px solid var(--wsy-border);
  border-radius: var(--wsy-radius-lg);
  box-shadow: var(--wsy-shadow-float);
  padding: 36px 32px;
  backdrop-filter: blur(12px);
}
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .sub { color: var(--wsy-text-secondary); font-size: 13px; margin-bottom: 26px; }
.login-brand {
  flex: 1; position: relative; overflow: hidden; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(11,23,48,.9), rgba(7,17,31,.95));
}
.login-brand .halo {
  position: absolute; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,108,255,.35), transparent 65%);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate(-8%, -6%) scale(1); } to { transform: translate(8%, 6%) scale(1.08); } }
.login-brand .slogan { position: relative; text-align: center; }
.login-brand .slogan .logo { font-size: 42px; font-weight: 700; letter-spacing: 2px; }
.login-brand .slogan p { color: var(--wsy-text-secondary); margin-top: 10px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--wsy-text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border-radius: var(--wsy-radius-sm);
  border: 1px solid var(--wsy-border); background: rgba(7,17,31,.6);
  color: var(--wsy-text-primary); font-size: 15px;
}
.field input:focus { outline: 2px solid rgba(78,161,255,.5); }
.form-error { color: var(--wsy-danger); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* ── 应用壳 ── */
#app-view { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 248px; background: var(--wsy-bg-secondary);
  border-right: 1px solid var(--wsy-border);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px;
  overflow-y: auto;
}
.sidebar .brand { font-weight: 700; padding: 8px 10px 16px; font-size: 16px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: var(--wsy-radius-sm); border: none;
  background: transparent; color: var(--wsy-text-primary); text-align: left;
}
.nav-item:hover { background: rgba(78,161,255,.1); }
.nav-item.active { background: rgba(78,161,255,.18); border-left: 3px solid var(--wsy-primary); font-weight: 600; }
.nav-item .count { margin-left: auto; color: var(--wsy-text-secondary); font-size: 12px; }
.nav-item.sub { padding-left: 30px; font-size: 13.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wsy-danger); flex: 0 0 8px; }
.dot.off { visibility: hidden; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: rgba(7,17,31,.85);
  border-bottom: 1px solid var(--wsy-border); backdrop-filter: blur(10px);
}
.topbar .title { font-weight: 700; }
.topbar .env {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--wsy-border); color: var(--wsy-text-secondary);
}
.topbar .env.production { border-color: rgba(62,207,178,.5); color: var(--wsy-ok); }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--wsy-text-secondary); font-size: 13px; }
#menu-toggle { display: none; }

.content { padding: 18px 20px 40px; max-width: 980px; width: 100%; margin: 0 auto; }
.page-title { font-size: 21px; margin-bottom: 14px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--wsy-border);
  background: transparent; color: var(--wsy-text-secondary);
}
.tab.active { background: rgba(78,161,255,.2); color: var(--wsy-text-primary); border-color: var(--wsy-primary); font-weight: 600; }

/* ── 通知卡片 ── */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.notif-card {
  position: relative; overflow: hidden;
  background: var(--wsy-surface-dark); border: 1px solid var(--wsy-border);
  border-radius: var(--wsy-radius-md); padding: 14px 16px;
  box-shadow: var(--wsy-shadow-soft); cursor: pointer;
  transition: transform .15s ease;
  touch-action: pan-y;
}
.notif-card:hover { transform: translateY(-1px); }
.notif-card .row1 { display: flex; align-items: flex-start; gap: 8px; }
.notif-card h3 { font-size: 15.5px; flex: 1; min-width: 0; word-break: break-word; }
.notif-card .unread-dot { position: absolute; top: 10px; right: 10px; }
.notif-card .body { color: var(--wsy-text-secondary); font-size: 13.5px; margin-top: 6px; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-card .meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; color: var(--wsy-text-secondary); font-size: 12px; }
.notif-card .actions { margin-left: auto; display: flex; gap: 6px; }
.badge {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--wsy-border);
  color: var(--wsy-text-secondary); white-space: nowrap;
}
.badge.retracted { border-color: rgba(242,193,78,.55); color: var(--wsy-warn); }
.badge.corrected { border-color: rgba(122,108,246,.6); color: #CDC6FF; }
.badge.priority-urgent { border-color: rgba(255,107,122,.6); color: var(--wsy-danger); }
.badge.priority-important { border-color: rgba(242,193,78,.5); color: var(--wsy-warn); }
.badge.mandatory { border-color: rgba(78,161,255,.6); color: var(--wsy-primary-hover); }
.badge.wi-OPEN { border-color: rgba(78,161,255,.5); color: var(--wsy-primary-hover); }
.badge.wi-COMPLETED { border-color: rgba(62,207,178,.5); color: var(--wsy-ok); }
.badge.wi-CANCELLED { border-color: rgba(175,196,228,.4); }

/* ── 状态页（Loading/Empty/Error） ── */
.state-box {
  text-align: center; color: var(--wsy-text-secondary);
  border: 1px dashed var(--wsy-border); border-radius: var(--wsy-radius-md);
  padding: 40px 20px;
}
.state-box .hint { font-size: 13px; margin-top: 8px; }
.skeleton { height: 74px; border-radius: var(--wsy-radius-md); background: linear-gradient(100deg, rgba(17,34,64,.5) 40%, rgba(78,161,255,.12) 50%, rgba(17,34,64,.5) 60%); background-size: 200% 100%; animation: shine 1.2s infinite; margin-bottom: 10px; }
@keyframes shine { to { background-position-x: -200%; } }

/* ── 详情抽屉 ── */
.drawer-mask { position: fixed; inset: 0; background: rgba(3,8,16,.6); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 41;
  background: var(--wsy-bg-secondary); border-left: 1px solid var(--wsy-border);
  box-shadow: var(--wsy-shadow-float); padding: 20px; overflow-y: auto;
  animation: slide-in .2s ease;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer h2 { font-size: 18px; margin: 10px 0; word-break: break-word; }
.drawer .full-body { color: var(--wsy-text-primary); line-height: 1.7; white-space: pre-wrap; word-break: break-word; background: rgba(7,17,31,.5); border: 1px solid var(--wsy-border); border-radius: var(--wsy-radius-sm); padding: 12px; margin: 12px 0; }
.drawer .kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; font-size: 13px; color: var(--wsy-text-secondary); margin: 12px 0; }
.drawer .kv b { color: var(--wsy-text-primary); font-weight: 500; word-break: break-all; }
.drawer .related { border-top: 1px solid var(--wsy-border); margin-top: 14px; padding-top: 12px; }
.drawer .close { float: right; }

/* ── 工作台 ── */
.wi-card { background: var(--wsy-surface-dark); border: 1px solid var(--wsy-border); border-radius: var(--wsy-radius-md); padding: 14px 16px; box-shadow: var(--wsy-shadow-soft); }
.wi-card .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wi-card .head h3 { flex: 1; font-size: 15.5px; }
.wi-card .subnotifs { margin-top: 10px; border-top: 1px dashed var(--wsy-border); padding-top: 8px; display: none; }
.wi-card.expanded .subnotifs { display: block; }
.wi-card .subnotifs .sub-item { display: flex; gap: 8px; padding: 6px 0; font-size: 13px; color: var(--wsy-text-secondary); cursor: pointer; }
.wi-card .subnotifs .sub-item:hover { color: var(--wsy-text-primary); }

/* ── 设置页 ── */
.panel { background: var(--wsy-surface-dark); border: 1px solid var(--wsy-border); border-radius: var(--wsy-radius-md); padding: 16px; margin-bottom: 14px; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.panel .desc { color: var(--wsy-text-secondary); font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: rgba(7,17,31,.55); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.secret-once {
  border: 1px solid rgba(242,193,78,.5); background: rgba(242,193,78,.08);
  padding: 12px; border-radius: var(--wsy-radius-sm); margin-top: 10px;
}
.device-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--wsy-border); flex-wrap: wrap; }
.device-row:last-child { border-bottom: none; }

/* ── Toast ── */
#toast-box { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: rgba(11,23,48,.95); border: 1px solid var(--wsy-border);
  border-radius: var(--wsy-radius-sm); padding: 10px 16px; box-shadow: var(--wsy-shadow-float);
  max-width: 90vw;
}
.toast.error { border-color: rgba(255,107,122,.5); }
.toast.notify { border-color: rgba(78,161,255,.5); }

/* ── 移动端 ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--wsy-shadow-float); min-width: 240px;
  }
  .sidebar.open { transform: none; }
  #menu-toggle { display: inline-flex; }
  #login-view { flex-direction: column; }
  .login-brand { min-height: 180px; flex: 0 0 auto; order: -1; }
  .login-panel { flex: 1; }
  .content { padding: 14px 12px 60px; }
  .notif-card .actions .label-text { display: none; }
}
