:root {
  --brand: #0F4C9B; --brand-dark: #0A2F63; --brand-deep: #071F45; --accent: #F5A623;
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-alt: #EEF2F7; --surface-hover: #F7FAFE;
  --outline: #DCE3EC; --outline-strong: #C5D0DF; --ink: #0F1B2D; --muted: #5A6B80;
  --primary: #0F4C9B; --primary-hover: #0B3E80; --primary-soft: #E3EEFB;
  --success: #16875A; --success-soft: #DDF3E9; --warning: #B86E00; --warning-soft: #FFF0D6;
  --danger: #C93B3B; --danger-soft: #FBE3E3; --info: #1F6FD1; --info-soft: #E1EDFC;
  --crew-a: #2E7DD7; --crew-b: #16875A; --crew-c: #D9822B; --crew-d: #8E5BD0; --crew-e: #D1496F;
  --sidebar-bg: #0A1E3D; --sidebar-ink: #D8E4F5; --sidebar-muted: #8CA5C9;
  --sidebar-hover: rgba(255,255,255,0.08);
  --shadow-sm: 0 1px 2px rgba(15,27,45,0.05); --shadow-md: 0 6px 20px rgba(15,27,45,0.08);
  --shadow-lg: 0 18px 48px rgba(10,25,50,0.22);
  --radius-md: 12px; --radius-lg: 16px; --font-size: 14px;
}
[data-theme="dark"] {
  --brand: #2B6FCC; --brand-dark: #143E7C; --brand-deep: #0B2650;
  --bg: #0D1420; --surface: #161F2E; --surface-alt: #1D2838; --surface-hover: #202D40;
  --outline: #2A374A; --outline-strong: #3A4B63; --ink: #E8EEF6; --muted: #9DACBF;
  --primary: #6AA7FF; --primary-hover: #8BBCFF; --primary-soft: #1B2E4A;
  --success: #4CC38A; --success-soft: #16342A; --warning: #F0B050; --warning-soft: #3A2D14;
  --danger: #FF8585; --danger-soft: #3F1D20; --info: #7DB2FF; --info-soft: #1B2E4A;
  --crew-a: #5B9FF0; --crew-b: #4CC38A; --crew-c: #F0A050; --crew-d: #B58CF0; --crew-e: #F0789B;
  --sidebar-bg: #08101C;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3); --shadow-md: 0 8px 24px rgba(0,0,0,0.35); --shadow-lg: 0 20px 50px rgba(0,0,0,0.55);
}
[data-font="sm"] { --font-size: 13px; } [data-font="md"] { --font-size: 14px; } [data-font="lg"] { --font-size: 15.5px; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif; font-size: var(--font-size); background: var(--bg); color: var(--ink); }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--outline-strong); border-radius: 99px; }
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 256px; flex-shrink: 0; background: linear-gradient(180deg, var(--sidebar-bg) 0%, #07162E 100%); color: var(--sidebar-ink); display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,0.06); user-select: none; }
.brand-box { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: rgba(255,255,255,0.08); padding: 3px; }
.brand-title { font-size: 14.5px; font-weight: 700; letter-spacing: 0.3px; color: #fff; }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); margin-top: 2px; }
.live-shift-card { margin: 12px 14px 6px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09); cursor: pointer; transition: background 0.15s; }
.live-shift-card:hover { background: rgba(255,255,255,0.11); }
.live-shift-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--sidebar-muted); margin-bottom: 4px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4CC38A; margin-right: 5px; box-shadow: 0 0 8px #4CC38A; }
.live-shift-main { font-size: 12.5px; font-weight: 600; color: #fff; }
.live-shift-sub { font-size: 11px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 8px 10px 14px; }
.nav-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--sidebar-muted); padding: 12px 10px 5px; opacity: 0.85; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; margin-bottom: 2px; color: var(--sidebar-ink); cursor: pointer; font-size: 13.5px; font-weight: 500; transition: background 0.14s, color 0.14s; border: none; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(43,111,204,0.85), rgba(15,76,155,0.55)); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,0.16); color: #fff; }
.nav-badge.danger { background: #DC3545; }
.sidebar-footer { padding: 10px 14px 12px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 11px; color: var(--sidebar-muted); display: flex; align-items: center; justify-content: space-between; }
.offline-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px; background: rgba(76,195,138,0.16); color: #6BE0A8; font-weight: 600; font-size: 10.5px; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { height: 62px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--outline); padding: 0 24px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); z-index: 10; }
.topbar-title-wrap { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 250px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--outline); background: var(--surface-alt); color: var(--muted); cursor: pointer; font-size: 13px; }
.search-trigger:hover { border-color: var(--primary); background: var(--surface); }
.search-trigger kbd { margin-left: auto; font-size: 11px; font-family: inherit; padding: 1px 6px; border-radius: 5px; background: var(--surface); border: 1px solid var(--outline); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--outline); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-alt); border-color: var(--outline-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.dot-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.view-canvas { flex: 1; overflow-y: auto; padding: 22px 26px 36px; }
.container { max-width: 1340px; margin: 0 auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: all 0.14s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #1A1200; } .btn-accent:hover { filter: brightness(0.95); }
.btn-outline { background: var(--surface); border-color: var(--outline-strong); color: var(--ink); } .btn-outline:hover { background: var(--surface-alt); border-color: var(--primary); color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); } .btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 15.5px; font-weight: 700; color: var(--ink); margin: 0; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hero-banner { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 60%, var(--brand-deep) 100%); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; box-shadow: var(--shadow-md); }
.hero-banner h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.hero-banner p { margin: 0; opacity: 0.88; font-size: 13.5px; max-width: 680px; line-height: 1.5; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-detail { display: grid; grid-template-columns: 1.65fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-detail { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } .sidebar { width: 220px; } }
.kpi-card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all 0.14s; }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-val { font-size: 28px; font-weight: 800; line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.chip-primary { background: var(--primary-soft); color: var(--primary); } .chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); } .chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); } .chip-muted { background: var(--surface-alt); color: var(--muted); }
.crew-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 800; color: #fff; }
.crew-A { background: var(--crew-a); } .crew-B { background: var(--crew-b); } .crew-C { background: var(--crew-c); } .crew-D { background: var(--crew-d); } .crew-E { background: var(--crew-e); } .crew-none { background: var(--outline-strong); color: var(--ink); }
.table-wrap { overflow-x: auto; border: 1px solid var(--outline); border-radius: var(--radius-md); background: var(--surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th { text-align: left; padding: 11px 14px; background: var(--surface-alt); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--outline); white-space: nowrap; }
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--outline); vertical-align: top; color: var(--ink); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr.clickable { cursor: pointer; } table.data-table tbody tr.clickable:hover { background: var(--surface-hover); }
.cell-main { font-weight: 600; color: var(--ink); } .cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.code-mono { font-family: Consolas, "Cascadia Code", monospace; font-size: 12.5px; font-weight: 700; color: var(--primary); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg-group { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--outline); }
.seg-btn { border: none; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.seg-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.input, .select, .textarea { width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--outline-strong); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13.5px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.search-inline { max-width: 340px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.note-box { padding: 10px 13px; border-radius: 10px; background: var(--primary-soft); color: var(--ink); border-left: 3px solid var(--primary); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
.warn-box { padding: 10px 13px; border-radius: 10px; background: var(--warning-soft); color: var(--ink); border-left: 3px solid var(--warning); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
.dropzone { border: 1.5px dashed var(--outline-strong); border-radius: 10px; padding: 14px; text-align: center; background: var(--surface-alt); cursor: pointer; }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attach-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--surface-alt); border: 1px solid var(--outline); }
.attach-thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; border: 1px solid var(--outline); flex-shrink: 0; cursor: pointer; }
.attach-icon { width: 38px; height: 38px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; flex-shrink: 0; }
.attach-info { flex: 1; min-width: 0; }
.attach-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { font-size: 11.5px; color: var(--muted); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--outline); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-dot { position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--primary-soft); }
.tl-card { background: var(--surface-alt); border: 1px solid var(--outline); border-radius: 12px; padding: 12px 14px; }
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12.5px; font-weight: 700; }
.tl-body { font-size: 13.5px; color: var(--ink); white-space: pre-wrap; line-height: 1.55; }
.kv-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.kv-item { padding-bottom: 8px; border-bottom: 1px dashed var(--outline); }
.kv-k { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.kv-v { font-size: 13.5px; font-weight: 600; color: var(--ink); word-break: break-word; }
.chart-wrap { position: relative; } .svg-chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--outline); stroke-dasharray: 3 3; } .chart-axis { fill: var(--muted); font-size: 11px; }
.bar-new { fill: var(--danger); } .bar-resolved { fill: var(--success); }
.bar-group:hover .bar-hit { fill: var(--primary-soft); opacity: 0.4; }
.chart-legend { display: flex; align-items: center; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); } .legend-unit { margin-left: auto; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; } .dot-new { background: var(--danger); } .dot-res { background: var(--success); }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 20; background: var(--ink); color: var(--surface); padding: 8px 11px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow-md); min-width: 150px; }
.tip-title { font-weight: 700; margin-bottom: 4px; opacity: 0.85; font-size: 11px; } .tip-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chart-empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.donut-layout { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; } .donut-svg { width: 168px; height: 168px; flex-shrink: 0; }
.donut-center-num { fill: var(--ink); font-size: 26px; font-weight: 800; } .donut-center-sub { fill: var(--muted); font-size: 11px; font-weight: 600; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 9px; }
.donut-leg-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; } .donut-leg-left { display: inline-flex; align-items: center; gap: 8px; }
.hbar-row { padding: 8px 10px; border-radius: 9px; cursor: pointer; } .hbar-row:hover { background: var(--surface-alt); }
.hbar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.hbar-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hbar-rank { width: 20px; height: 20px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.hbar-track { height: 7px; border-radius: 99px; background: var(--surface-alt); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--info)); }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-muted { color: var(--muted); }
.schedule-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.schedule-grid th, .schedule-grid td { border: 1px solid var(--outline); padding: 7px 6px; text-align: center; }
.schedule-grid th { background: var(--surface-alt); font-weight: 700; color: var(--muted); }
.schedule-grid tr.issue-row td { background: var(--danger-soft); }
.schedule-cell-btn { border: none; cursor: pointer; padding: 0; background: transparent; }
.suggest-card { padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--outline); background: var(--surface); cursor: pointer; margin-bottom: 8px; }
.suggest-card:hover { border-color: var(--primary); } .suggest-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .preset-grid { grid-template-columns: repeat(2, 1fr); } }
.preset-card { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--outline); background: var(--surface); cursor: pointer; text-align: left; transition: all 0.14s; }
.preset-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.preset-title { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.preset-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(7,18,36,0.58); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal-box { background: var(--surface); border: 1px solid var(--outline); border-radius: 16px; width: 100%; max-width: 680px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn 0.14s ease-out; }
.modal-box.modal-lg { max-width: 960px; } .modal-box.modal-sm { max-width: 480px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--outline); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--outline); background: var(--surface-alt); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); max-width: 380px; white-space: pre-line; animation: modalIn 0.16s ease-out; }
.toast.error { background: var(--danger); color: #fff; } .toast.success { background: var(--success); color: #fff; }
.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state h4 { margin: 10px 0 6px; color: var(--ink); font-size: 15px; }
#print-root { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .app-shell, .modal-backdrop, .toast-stack { display: none !important; }
  #print-root { display: block !important; font-size: 10pt; }
  #print-root h1 { font-size: 15pt; color: #0F4C9B; margin: 0 0 3pt; }
  #print-root .print-meta { font-size: 9pt; color: #555; margin-bottom: 10pt; }
  #print-root table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8.5pt; }
  #print-root th { background: #0F4C9B; color: #fff; padding: 5pt 5pt; text-align: left; border: 1px solid #9ab; word-wrap: break-word; overflow-wrap: break-word; }
  #print-root td { padding: 4.5pt 5pt; border: 1px solid #cbd5e1; vertical-align: top; word-wrap: break-word; overflow-wrap: break-word; line-height: 1.4; }
  #print-root td.print-code-col { font-family: Consolas, monospace; font-weight: 700; color: #0F4C9B; }
  #print-root td.print-note-col { white-space: pre-wrap; line-height: 1.45; }
  #print-root tr.print-child-row td { background: #F7FAFD; color: #334155; }
  #print-root tr.print-child-row td.print-code-col { font-weight: 600; color: #475569; }
  #print-root tr.print-sec-row td { font-size: 10.5pt; font-weight: 700; color: #0F4C9B; background: #E8F0FA; padding: 6pt 8pt; border: 1px solid #b5c8e4; }
  #print-root tr.print-gap-row td { height: 10pt; border: none; background: transparent; padding: 0; }
}

/* Screenshot & Ctrl+V Paste Enhancements */
.attach-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 8px;
}
.dropzone-compact {
  border: 1.5px dashed var(--outline-strong);
  border-radius: 10px; padding: 10px 12px;
  background: var(--surface-alt); margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone-compact.dragover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-hint {
  font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.dropzone-hint kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--outline-strong); color: var(--ink);
}
.snip-wait-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding: 8px 11px; border-radius: 9px;
  background: var(--info-soft); border: 1px solid var(--primary);
  font-size: 12.5px; color: var(--ink);
}
.snip-pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-right: 7px;
  animation: snipPulse 1.1s infinite ease-in-out;
}
@keyframes snipPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
.img-lightbox {
  position: fixed; inset: 0; background: rgba(5, 12, 24, 0.9);
  display: flex; flex-direction: column;
  z-index: 2500; user-select: none; overflow: hidden;
}
.img-lightbox-stage {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.img-lightbox-stage.is-zoomed { cursor: grab; }
.img-lightbox-stage.is-panning { cursor: grabbing; }
.img-lightbox-stage img {
  max-width: 92vw; max-height: 80vh; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  transform-origin: center center;
  will-change: transform;
  user-select: none; -webkit-user-drag: none;
  cursor: zoom-in;
}
.img-lightbox-stage.is-zoomed img { cursor: grab; }
.img-lightbox-stage.is-panning img { cursor: grabbing; }
.img-lightbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 18px;
  background: rgba(10, 20, 36, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff; flex-wrap: wrap;
}
.img-lightbox-cap {
  font-size: 13px; color: rgba(255, 255, 255, 0.92);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 52vw;
}
.img-lightbox-cap small { color: rgba(255, 255, 255, 0.62); margin-left: 8px; }
.img-lightbox-ctrls {
  display: flex; align-items: center; gap: 6px;
}
.lb-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff; padding: 5px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.14s;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.22); }
.lb-zoom-pct {
  min-width: 54px; text-align: center;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #FFE09E;
}

/* Live Shift Countdown & Equipment Autocomplete */
.live-shift-countdown {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(245, 166, 35, 0.2);
  color: #FFD17A;
  font-size: 11px;
  font-weight: 700;
}
.hero-countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(245, 166, 35, 0.24);
  border: 1px solid rgba(245, 166, 35, 0.55);
  color: #FFE09E;
  font-size: 12px;
  font-weight: 700;
}
.ac-wrap { position: relative; }
.ac-menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 1500;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 230px;
  overflow-y: auto;
}
.ac-menu[hidden] { display: none; }
.ac-item {
  padding: 8px 11px;
  cursor: pointer;
  border-bottom: 1px solid var(--outline);
  transition: background 0.1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: var(--primary-soft); }
.ac-title { font-size: 13px; font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ac-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Shift Schedule Split & 5-Tab Full Crew Roster (A-E) === */
.grid-shifts { display: grid; grid-template-columns: 1.05fr 1.25fr; gap: 18px; align-items: start; }
@media (max-width: 1120px) { .grid-shifts { grid-template-columns: 1fr; } }

.crew-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--outline);
  margin-bottom: 12px;
}
.crew-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.crew-tab-btn:hover { background: var(--surface-hover); color: var(--ink); }
.crew-tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--outline);
  box-shadow: var(--shadow-sm);
}
.crew-tab-A.active { border-color: var(--crew-a); color: var(--crew-a); }
.crew-tab-B.active { border-color: var(--crew-b); color: var(--crew-b); }
.crew-tab-C.active { border-color: var(--crew-c); color: var(--crew-c); }
.crew-tab-D.active { border-color: var(--crew-d); color: var(--crew-d); }
.crew-tab-E.active { border-color: var(--crew-e); color: var(--crew-e); }
.crew-tab-dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }

.roster-tab-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.roster-tab-scroll {
  overflow-x: auto;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--surface);
}
table.roster-tab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}
table.roster-tab-table th {
  text-align: left;
  padding: 9px 10px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--outline);
}
table.roster-tab-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--outline);
  vertical-align: top;
  color: var(--ink);
}
table.roster-tab-table tbody tr:last-child td { border-bottom: none; }
table.roster-tab-table tbody tr.roster-row-priority td {
  background: var(--primary-soft);
  border-bottom: 1.5px solid var(--primary);
}
.roster-pos-name { font-weight: 600; line-height: 1.35; }
table.roster-tab-table tbody tr.roster-row-priority .roster-pos-name {
  font-weight: 700;
  color: var(--primary);
}
.roster-names-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.roster-person-item {
  line-height: 1.4;
  font-weight: 500;
}
table.roster-tab-table tbody tr.roster-row-priority .roster-person-item {
  font-weight: 700;
}
.roster-scope-note {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px dashed var(--outline);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}


/* ============================================================================
 * EVNQT1 HELP DESK ONLINE — Sync Status, Cloud Storage, Migration & Mobile UI
 * ============================================================================ */
.sidebar-account {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.acc-email {
  font-size: 11.5px;
  color: #CBD5E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.btn-logout-mini {
  background: rgba(255,255,255,0.09);
  color: #E2E8F0;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-logout-mini:hover { background: rgba(239,68,68,0.28); border-color: rgba(239,68,68,0.55); color: #FFF; }

/* Sync status widget in header */
.sync-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 11px;
  background: var(--surface-alt, #F1F5F9);
  border: 1px solid var(--outline, #DCE6F2);
  flex-shrink: 0;
}
.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94A3B8;
  flex-shrink: 0;
}
.sync-widget[data-state="synced"] .sync-dot { background: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
.sync-widget[data-state="syncing"] .sync-dot,
.sync-widget[data-state="loading"] .sync-dot { background: #2563EB; animation: syncPulse 1.1s infinite; }
.sync-widget[data-state="pending"] .sync-dot { background: #D97706; }
.sync-widget[data-state="offline"] .sync-dot { background: #64748B; }
.sync-widget[data-state="reauth"] .sync-dot,
.sync-widget[data-state="error"] .sync-dot { background: #DC2626; }

@keyframes syncPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

.sync-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.sync-label { font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.sync-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.sync-btn { padding: 4px 9px !important; font-size: 11.5px !important; }

/* Upload / Migration Progress Bars */
.progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: var(--surface-alt, #E2E8F0);
  overflow: hidden;
  border: 1px solid var(--outline, #CBD5E1);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0F4C9B 0%, #2563EB 60%, #38BDF8 100%);
  width: 0%;
  transition: width 0.2s ease;
}

/* PDF Preview Frame inside Modal */
.pdf-preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: #F8FAFC;
}

/* Cloud onboarding banner / card */
.onboarding-card {
  max-width: 720px;
  margin: 28px auto;
  padding: 28px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-md, 0 12px 32px rgba(15,23,42,0.08));
}
.onboarding-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.onboarding-option {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: space-between;
}

/* Mobile-only controls hidden on Desktop */
.mobile-only-btn { display: none !important; }
.mobile-bottom-nav { display: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 14, 30, 0.56);
  backdrop-filter: blur(2px);
  z-index: 95;
}

/* ==================== RESPONSIVE MOBILE LAYOUT (<= 900px) ==================== */
@media (max-width: 900px) {
  .mobile-only-btn { display: inline-flex !important; }

  .app-shell {
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 276px;
    max-width: 84vw;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.4);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar-title { font-size: 16px; }
  .topbar-sub { display: none; }
  .search-trigger {
    order: 4;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }
  .search-trigger kbd { display: none; }

  .sync-widget {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding: 6px 10px;
  }

  .topbar-actions {
    gap: 6px;
  }
  #btn-quick-work span { display: none; }
  #btn-quick-work { padding: 0 11px; min-height: 38px; }

  .view-canvas {
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Bảng rộng cuộn ngang mượt, không vỡ bố cục */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table th, .data-table td {
    padding: 9px 10px;
    font-size: 12.5px;
  }

  /* Form hiển thị theo chiều dọc & nút chạm đủ lớn */
  .form-grid, .grid-2, .grid-3, .grid-4, .onboarding-actions {
    grid-template-columns: 1fr !important;
  }
  .input, .select, .textarea, .btn {
    min-height: 40px;
  }
  .btn-xs { min-height: 34px; padding: 5px 10px; }

  /* Modal không tràn màn hình trên mobile */
  .modal-backdrop { padding: 10px !important; align-items: flex-end; }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh !important;
    border-radius: 18px 18px 12px 12px !important;
  }
  .modal-body { padding: 14px !important; }
  .modal-foot { flex-wrap: wrap; gap: 8px; padding: 12px 14px !important; }

  /* Attach rows gọn trên mobile */
  .attach-row { flex-wrap: wrap; gap: 8px; }
  .attach-toolbar { flex-wrap: wrap; gap: 6px; }

  /* Bottom Navigation Bar cho Mobile */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: var(--surface, #FFFFFF);
    border-top: 1px solid var(--outline, #DCE6F2);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  }
  .mbn-item {
    border: none;
    background: transparent;
    color: var(--muted, #64748B);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    min-height: 46px;
  }
  .mbn-item svg { width: 20px; height: 20px; }
  .mbn-item.active { color: var(--primary, #0F4C9B); }
}
