:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --text: #2d2a26;
  --muted: #78716c;
  --line: #e7e5e4;
  --primary: #8b2e2e;
  --primary-dark: #6b1f1f;
  --green: #15803d;
  --red: #b91c1c;
  --orange: #c2410c;
  --yellow: #a16207;
  --blue: #8b2e2e;
  --dark: #1c1917;
  --gold: #c9a227;
  --shadow: 0 14px 40px rgba(87, 42, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.danger { color: var(--red); }
.success { color: var(--green); }
.warning { color: var(--orange); }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
  background: linear-gradient(135deg, #4a1515 0%, #8b2e2e 48%, #faf8f5 48.2%, #faf8f5 100%);
}
.login-hero { color: #fff; padding: 72px 56px; display: flex; flex-direction: column; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.login-brand img { height: 64px; max-width: 220px; object-fit: contain; background: transparent; border: 0; outline: 0; box-shadow: none; padding: 0; }
.login-hero h1 { font-size: 42px; margin: 0; letter-spacing: 2px; }
.login-company { margin-top: 6px; font-size: 15px; opacity: .9; letter-spacing: .5px; }
.login-hero p { font-size: 17px; line-height: 1.9; opacity: .92; max-width: 460px; }
.login-card-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: min(440px, 100%); background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.7); border-radius: 24px; padding: 34px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 8px; font-size: 26px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; }
.demo-accounts { margin-top: 18px; padding: 12px; background: #f1f5f9; border-radius: 12px; color: #475569; font-size: 12px; line-height: 1.7; }
.login-links { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; }
.link-btn { border: 0; background: transparent; color: var(--primary); font-size: 13px; cursor: pointer; padding: 4px 8px; }
.link-btn:hover { text-decoration: underline; }
.sms-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.sms-row .btn { white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; min-width: 0; }
.brand-logo { height: 42px; max-width: 180px; object-fit: contain; display: block; background: transparent; border: 0; outline: 0; box-shadow: none; }
.brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }
.brand-company { font-size: 15px; color: #0f172a; white-space: nowrap; }
.brand-platform { font-size: 20px; color: var(--primary); letter-spacing: 1px; font-weight: 700; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.userbox .btn-ghost { border: 0; background: transparent; color: #475569; box-shadow: none; }
.userbox .btn-ghost:hover { background: #eef4ff; color: var(--primary); }
.userbox .btn-ghost:focus { outline: none; box-shadow: none; }
.role-legend { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; display: grid; gap: 6px; }
.notif-btn { position: relative; }
.notif-badge { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }
.notif-item { padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #fef3c7; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.notif-del { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.notif-del:hover { color: var(--red); }
.dept-multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; max-height: 160px; overflow-y: auto; }
.dept-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.dept-check:hover { background: #eef4ff; }
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 67px); }
.sidebar { background: #4a1515; color: #fef3c7; padding: 18px 12px; }
.side-title { padding: 8px 12px 16px; color: #fcd34d; font-size: 12px; letter-spacing: 1px; }
.nav-btn { width: 100%; border: 0; background: transparent; color: #fef3c7; text-align: left; padding: 12px 14px; border-radius: 12px; margin-bottom: 6px; }
.nav-btn:hover, .nav-btn.active { background: rgba(201, 162, 39, .18); color: #fff; }
.main { padding: 22px; min-width: 0; }
.mobile-layout { min-height: calc(100vh - 67px); padding: 16px; max-width: 980px; margin: 0 auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 24px rgba(15,35,70,.06); }
.panel-pad { padding: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 88px; height: 88px; border-radius: 50%; background: rgba(23,105,224,.09); }
.stat .num { font-size: 30px; font-weight: 800; margin-top: 8px; }
.stat .label { color: var(--muted); font-size: 13px; }

.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: #374151; font-weight: 700; }
.input, .select, .textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--text); outline: none; }
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 46, 46, .12); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.btn { border: 0; border-radius: 12px; padding: 10px 14px; background: #e2e8f0; color: #0f172a; font-weight: 700; }
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(139, 46, 46, .2); }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 10px; border-radius: 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 760px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; font-size: 13px; }
th { background: #f8fafc; color: #475569; font-weight: 800; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge.blue { background: #fee2e2; color: #8b2e2e; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.yellow { background: #fef9c3; color: #a16207; }
.badge.gray { background: #e5e7eb; color: #4b5563; }

.task-card { display: grid; gap: 10px; }
.task-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.task-title { font-weight: 800; font-size: 16px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; white-space: nowrap; font-weight: 700; color: #475569; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab:hover { border-color: var(--primary); color: var(--primary); }

.check-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fbfdff; }
.check-item .q { font-weight: 700; margin-bottom: 8px; }
.check-controls { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-preview img, .photo-preview a { width: 86px; height: 86px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; background: #f8fafc; color: var(--muted); text-decoration: none; font-size: 12px; }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal { width: min(980px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; }
.close { border: 0; background: #e2e8f0; width: 34px; height: 34px; border-radius: 10px; }

/* ===== 展示大屏：高对比深色科技风 ===== */
.screen-page { min-height: 100vh; min-height: 100dvh; background: linear-gradient(160deg, #0a1628 0%, #0d1b2e 50%, #081120 100%); color: #e8eef7; padding: 22px; }
.screen-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid rgba(56, 189, 248, .25); }
.screen-title { font-size: 30px; font-weight: 900; letter-spacing: 2px; color: #ffffff; text-shadow: 0 0 20px rgba(56, 189, 248, .4); }
.screen-head .muted { color: #7dd3fc; }
.screen-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.screen-card { background: linear-gradient(145deg, rgba(21, 42, 68, .85), rgba(13, 27, 46, .9)); border: 1px solid rgba(56, 189, 248, .3); border-radius: 16px; padding: 18px; box-shadow: 0 4px 20px rgba(0,0,0,.3), inset 0 1px 0 rgba(125, 211, 252, .1); }
.screen-card .muted { color: #94b8d8; font-size: 14px; }
.screen-card .num { font-size: 38px; font-weight: 900; color: #38bdf8; text-shadow: 0 0 16px rgba(56, 189, 248, .5); margin-top: 6px; }
.screen-card:nth-child(1) .num { color: #34d399; text-shadow: 0 0 16px rgba(52, 211, 153, .5); }
.screen-card:nth-child(2) .num { color: #38bdf8; text-shadow: 0 0 16px rgba(56, 189, 248, .5); }
.screen-card:nth-child(3) .num { color: #f87171; text-shadow: 0 0 16px rgba(248, 113, 113, .5); }
.screen-card:nth-child(4) .num { color: #fbbf24; text-shadow: 0 0 16px rgba(251, 191, 36, .5); }
.screen-main { display: grid; grid-template-columns: 1.35fr .85fr; gap: 14px; }
.screen-card h3 { color: #ffffff; font-size: 17px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(56, 189, 248, .2); }
.screen-table { min-width: 0; background: transparent; color: #e8eef7; }
.screen-table th { background: rgba(21, 42, 68, .9); color: #7dd3fc; font-weight: 800; border-bottom: 2px solid rgba(56, 189, 248, .3); }
.screen-table td { border-color: rgba(56, 189, 248, .12); background: rgba(13, 27, 46, .5); color: #dbe7f3; }
.screen-table tr:hover td { background: rgba(56, 189, 248, .08); }
.bar-row { display: grid; grid-template-columns: 110px 1fr 54px; gap: 10px; align-items: center; margin: 12px 0; color: #dbe7f3; }
.bar { height: 14px; border-radius: 999px; background: rgba(56, 189, 248, .15); overflow: hidden; border: 1px solid rgba(56, 189, 248, .2); }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, #38bdf8); border-radius: inherit; box-shadow: 0 0 10px rgba(56, 189, 248, .5); }
.screen-page .empty { background: rgba(21, 42, 68, .5); border-color: rgba(56, 189, 248, .2); color: #7dd3fc; }
.screen-head .btn-ghost { border: 1px solid rgba(125, 211, 252, .4); color: #7dd3fc; background: rgba(21, 42, 68, .5); }
.screen-head .btn-ghost:hover { background: rgba(56, 189, 248, .2); color: #fff; }
.screen-head .btn-primary { background: #0ea5e9; }
.screen-head .btn-primary:hover { background: #0284c7; }

/* 三区域布局 */
.screen-top { margin-bottom: 14px; }
.screen-top-title { font-size: 15px; font-weight: 800; color: #7dd3fc; margin-bottom: 12px; letter-spacing: 1px; }
.screen-stat { text-align: center; padding: 8px; }
.screen-stat .num { font-size: 36px; font-weight: 900; color: #38bdf8; text-shadow: 0 0 16px rgba(56,189,248,.5); margin-top: 4px; }
.screen-stat .muted { color: #94b8d8; font-size: 13px; }
.screen-alerts { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(56,189,248,.2); display: grid; gap: 8px; }
.alert-item { padding: 10px 14px; border-radius: 10px; font-size: 14px; border-left: 4px solid; }
.alert-item.danger { background: rgba(248,113,113,.12); border-color: #f87171; color: #fecaca; }
.alert-item.warning { background: rgba(251,191,36,.12); border-color: #fbbf24; color: #fde68a; }
.alert-item.info { background: rgba(56,189,248,.12); border-color: #38bdf8; color: #bae6fd; }
.alert-item.success { background: rgba(52,211,153,.12); border-color: #34d399; color: #a7f3d0; }
.screen-task-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(56,189,248,.12); }
.screen-task-item:last-child { border-bottom: 0; }
.screen-task-info .strong { color: #fff; font-size: 14px; }
.screen-task-info .muted { color: #94b8d8; }
.screen-task-tags { display: flex; gap: 6px; flex-shrink: 0; }
.row-danger td { background: rgba(248,113,113,.08) !important; }
.settings-section { margin-bottom: 20px; }
.settings-title { font-size: 13px; font-weight: 800; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }
.settings-list { display: grid; gap: 8px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.settings-item:hover { background: #f8fafc; border-color: var(--primary); }
.settings-info { display: grid; gap: 8px; }
.settings-info-row { display: flex; justify-content: space-between; padding: 10px 14px; background: #f8fafc; border-radius: 10px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 99; background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 999px; box-shadow: var(--shadow); max-width: min(680px, calc(100vw - 32px)); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed #cbd5e1; border-radius: 16px; background: #fbfdff; }

/* ===== 宽屏电脑 1441px+ ===== */
@media (min-width: 1441px) {
  .main { padding: 28px 36px; }
  .main > .grid, .main > .panel { max-width: 1560px; margin-left: auto; margin-right: auto; }
  .stat .num { font-size: 34px; }
  th, td { font-size: 14px; }
}

/* ===== 平板 769–1024px ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .layout { grid-template-columns: 190px 1fr; }
  .sidebar { padding: 12px 8px; }
  .nav-btn { padding: 10px 12px; font-size: 13px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 18px; }
  .brand-company { font-size: 13px; }
  .brand-platform { font-size: 18px; }
  .brand-logo { height: 38px; max-width: 150px; }
}

/* ===== 手机与小平板 ≤900px ===== */
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; background: linear-gradient(180deg, #4a1515 0, #8b2e2e 34%, #faf8f5 34.2%); }
  .login-hero { padding: 42px 28px 20px; }
  .login-hero h1 { font-size: 30px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; padding: 10px; position: sticky; top: 0; z-index: 15; }
  .side-title { display: none; }
  .nav-btn { width: auto; white-space: nowrap; margin-bottom: 0; min-height: 40px; }
  .main { padding: 14px; }
  .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .screen-grid { grid-template-columns: repeat(2, 1fr); }
  .screen-main { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand-logo { height: 36px; max-width: 140px; }
  .brand-company { font-size: 13px; white-space: normal; }
  .brand-platform { font-size: 18px; }
  .login-brand img { height: 52px; max-width: 170px; }
  .userbox { flex-wrap: wrap; }
  .check-controls { grid-template-columns: 1fr; }
  .btn { min-height: 40px; }
  .input, .select, .textarea { font-size: 16px; }
  table { min-width: 640px; }
  .modal { max-height: 96vh; }
}

/* ===== 小屏手机 ≤480px ===== */
@media (max-width: 480px) {
  .login-hero { padding: 30px 20px 14px; }
  .login-hero h1 { font-size: 24px; }
  .login-hero p { font-size: 14px; }
  .login-brand img { height: 44px; max-width: 140px; }
  .login-card { padding: 22px; border-radius: 18px; }
  .main { padding: 10px; }
  .panel-pad { padding: 14px; }
  .card { padding: 12px; }
  .stat .num { font-size: 24px; }
  .screen-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .screen-card { padding: 10px; }
  .screen-card .num { font-size: 24px; }
  .screen-title { font-size: 20px; }
  .tabs { gap: 6px; }
  .tab { padding: 8px 12px; font-size: 13px; }
  .task-title { font-size: 15px; }
  .actions .btn { flex: 1 1 auto; }
}

/* ===== 大屏电视 / 投影 1600px+ ===== */
@media (min-width: 1600px) {
  .screen-page { padding: 2vw 2.5vw; }
  .screen-title { font-size: clamp(28px, 2.2vw, 44px); }
  .screen-head .muted { font-size: clamp(13px, 1vw, 18px); }
  .screen-grid { gap: 1.2vw; margin-bottom: 1.2vw; }
  .screen-card { padding: 1.4vw; border-radius: 1.2vw; }
  .screen-card .muted { font-size: clamp(14px, 1.1vw, 20px); }
  .screen-card .num { font-size: clamp(34px, 2.8vw, 56px); }
  .screen-card h3 { font-size: clamp(17px, 1.3vw, 24px); }
  .screen-table th, .screen-table td { font-size: clamp(14px, 1.05vw, 20px); padding: 0.8vw 1vw; }
  .bar-row { grid-template-columns: clamp(110px, 8vw, 180px) 1fr clamp(54px, 4vw, 90px); font-size: clamp(14px, 1.05vw, 20px); }
  .bar { height: clamp(12px, 0.9vw, 20px); }
  .screen-head .btn { font-size: clamp(13px, 1vw, 18px); padding: 0.7vw 1.2vw; }
}

/* ===== 4K 电视 2560px+ ===== */
@media (min-width: 2560px) {
  .screen-page { padding: 2.4vw 3vw; }
  .screen-main { gap: 1.4vw; }
}

/* ===== 竖屏电视/竖屏显示器 ===== */
@media (orientation: portrait) and (min-width: 900px) {
  .screen-main { grid-template-columns: 1fr; }
  .screen-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 打印 ===== */
@media print {
  .topbar, .sidebar, .actions, .btn, .toast { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .panel, .card { box-shadow: none; border: 1px solid #999; }
}
