:root {
  font-family: "Malgun Gothic", "맑은 고딕", Inter, system-ui, sans-serif;
  color: #18253a;
  background: #fff;
  font-size: 14px;
  font-synthesis: none;
  --accent: #3278f5;
  --accent-hover: #205dcc;
  --border: #e2e8f1;
  --muted: #5d6d83;
  --sidebar: #fff;
  --panel: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-hover); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid #638cff; outline-offset: 3px; }
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.app main { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow: auto;
  background: var(--sidebar); color: #25292e; border-right: 1px solid #edf0f3;
  display: flex; flex-direction: column; padding: 0 18px 18px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: -.045em; }
.sidebar .brand { padding: 26px 6px; margin: 0 0 7px; }
.brand b { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: #03a65a; background: #e9f8ef; font-size: 19px; }
.workspace { color: #75808d; font-size: 11px; font-weight: 700; margin: 0 8px; }
.cafes, nav { display: grid; gap: 4px; }
.cafes a, nav a { display: block; color: #4c5563; text-decoration: none; border-radius: 7px; padding: 9px 11px; }
.cafes a { font-size: 12px; }
.cafes a:hover, nav a:hover { background: #f4f7fa; color: #20252c; }
.cafes a.active { background: #f0f8f3; color: #087840; font-weight: 700; }
nav { margin-top: 8px; padding-top: 20px; border-top: 1px solid #edf0f3; gap: 7px; }
nav .workspace { margin-bottom: 3px; }
nav a { min-height: 45px; padding-block: 12px; }
nav a.active { background: #eef5ff; color: #2464cf; font-weight: 700; }
nav a span { display: inline-block; width: 26px; font-size: 17px; color: #67717e; line-height: 1; }
nav a.active span { color: #2464cf; }
.account { margin-top: auto; border-top: 1px solid #edf0f3; padding: 13px 3px 0; }
.identity { display: flex; align-items: center; gap: 9px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #edf0f3; color: #65717f; font-size: 12px; }
.account small { display: block; color: #67717e; margin-top: 3px; }
.account form { margin-top: 10px; }
.account button { width: 100%; padding: 7px 10px; background: transparent; color: #65717f; border: 1px solid #e0e5ea; border-radius: 20px; font-size: 12px; }
.account button:hover { background: #f4f7fa; color: #20252c; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  min-height: 94px; padding: 13px clamp(16px, 2.1vw, 32px); background: #fff; border-bottom: 1px solid var(--border);
}
h1 { margin: 0; font-size: clamp(21px, 2vw, 29px); letter-spacing: -.055em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-context { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.content { padding: 30px clamp(16px, 3vw, 48px) 60px; max-width: 1540px; margin-inline: auto; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 310px); gap: 16px; align-items: start; }
.side-panel { min-width: 0; }
.side-panel form { display: grid; gap: 13px; }
.side-panel form > button { justify-self: start; }
.side-panel input:not([type=checkbox]), .side-panel textarea { width: 100%; min-width: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.metrics a { display: grid; gap: 8px; padding: 24px 22px; border: 1px solid #edf3fb; border-radius: 18px; background: #f3f8ff; text-decoration: none; color: inherit; }
.metrics a:hover { border-color: #a4bbf2; background: #fafdff; }
.metrics span, .metrics small { color: var(--muted); font-size: 12px; }
.metrics strong { font-size: clamp(19px, 2vw, 29px); letter-spacing: -.035em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
section, .login { min-width: 0; padding: 22px 24px; margin-bottom: 22px; border: 1px solid #e9edf2; border-radius: 16px; background: var(--panel); }
h2 { margin: 0 0 13px; font-size: 16px; letter-spacing: -.02em; }
p { line-height: 1.5; }
.muted, .note, td small { color: var(--muted); }
.note { margin: 7px 0 11px; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
td, th { padding: 14px 10px; vertical-align: middle; border-bottom: 1px solid #eaf0f6; overflow-wrap: anywhere; }
th { background: #f5f7fb; color: #4a5b73; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faff; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
td small { display: block; margin-top: 4px; }
td form { margin: 0; }
.tag { display: inline-block; padding: 3px 7px; margin: 2px 4px 2px 0; border: 1px solid #dae4f3; border-radius: 5px; background: #eef3fb; color: #3e5476; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-op { display: inline-block; padding: 2px 5px; border-radius: 4px; font-size: 10px; font-weight: 700; background: #e6f8ee; color: #087840; vertical-align: middle; }
.badge-test { display: inline-block; padding: 2px 5px; border-radius: 4px; font-size: 10px; font-weight: 700; background: #fff3e0; color: #b76e00; vertical-align: middle; }
.cafe-tag { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.tag-eungye { background: #eaf6ef; color: #087840; border: 1px solid #bce6cd; }
.tag-test { background: #fff8e1; color: #b76e00; border: 1px solid #ffe082; }
.tag-warn { background: #fde8e4; color: #b71c1c; border-color: #f8c3ba; }
.banner { padding: 12px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 13px; line-height: 1.5; }
.banner-warning { background: #fff8e1; border: 1px solid #ffe082; color: #6d4c41; }
.banner-warning a { color: #b76e00; font-weight: 700; }
.btn-sm { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-decoration: none; background: #eef5ff; color: #2464cf; border: 1px solid #c9dcfa; }
.btn-sm:hover { background: #2464cf; color: #fff; }
details { border-top: 1px solid var(--border); margin-top: 13px; padding-top: 11px; }
summary { cursor: pointer; font-weight: 700; color: var(--accent-hover); }
form { display: flex; flex-wrap: wrap; gap: 11px; align-items: end; margin-top: 11px; }
.search { margin: 0 0 12px; padding: 11px; border-radius: 7px; background: #f5f7fb; }
.search a { align-self: center; font-size: 12px; }
label { display: grid; gap: 5px; min-width: 0; color: #36465e; font-size: 12px; font-weight: 700; }
input, textarea, select, button { font: inherit; }
input, textarea, select { min-width: 0; max-width: 100%; padding: 8px 9px; border: 1px solid #cad5e5; border-radius: 6px; background: #fff; color: inherit; }
textarea { width: min(100%, 470px); min-width: min(280px, 65vw); min-height: 78px; }
.check { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
button { cursor: pointer; border: 0; border-radius: 6px; background: #eef5ff; color: #2464cf; font-weight: 700; padding: 8px 13px; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .6; cursor: wait; }
.success, .form-error { padding: 10px 12px; border-radius: 7px; }
.success { margin: 0 0 13px; background: #e6f4ed; color: #166041; }
.form-error { flex-basis: 100%; margin: 0; background: #fbe9e7; color: #81281f; }
.guest main { padding: 10vh 20px; }
.login { max-width: 440px; margin: auto; padding: 27px; }
.login .brand { margin-bottom: 21px; }
.login form { display: grid; }
.login input { width: 100%; }

/* Excel Import UI */
.list-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.list-controls .search { margin: 0; flex: 1; }
.btn-import-open { background: #eef5ff; color: #2464cf; border: 1px solid #c9dcfa; font-weight: 700; padding: 9px 15px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn-import-open:hover { background: #2464cf; color: #fff; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-card {
  background: #fff; border-radius: 14px; max-width: 1440px; width: 100%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; background: #fafbfc;
}
.modal-header h3 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.btn-modal-close { background: transparent; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.btn-modal-close:hover { background: #e2e8f0; color: #000; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; background: #f8fafc;
}

.banner-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.banner-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.import-file-box { padding: 16px; border: 2px dashed #cbd5e1; border-radius: 10px; background: #f8fafc; margin-bottom: 16px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-card { padding: 12px 14px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.summary-card span { font-size: 11px; color: var(--muted); font-weight: 600; }
.summary-card strong { font-size: 18px; font-weight: 700; color: #1e293b; }
.summary-card.highlight { background: #f0fdf4; border-color: #bbf7d0; }
.summary-card.highlight strong { color: #15803d; }
.summary-card.warning { background: #fffbeb; border-color: #fde68a; }
.summary-card.warning strong { color: #b45309; }

.preview-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab { padding: 5px 11px; font-size: 12px; font-weight: 700; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; color: #475569; cursor: pointer; text-decoration: none; }
.filter-tab:hover { background: #f1f5f9; color: #1e293b; }
.filter-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.edit-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.edit-controls button:disabled { opacity: .45; cursor: not-allowed; }
.bulk-edit-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid #dbeafe; border-radius: 8px; background: #f8fbff; font-size: 12px; }
.bulk-edit-bar input { min-width: 240px; padding: 5px 8px; font-size: 12px; }
.bulk-edit-bar select { padding: 5px 8px; font-size: 12px; }

.preview-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.preview-table-wrap { max-height: 460px; border: 1px solid #e2e8f0; border-radius: 8px; }
.preview-table { font-size: 12px; }
.preview-table th { position: sticky; top: 0; background: #f1f5f9; z-index: 2; padding: 10px 8px; }
.preview-table td { padding: 8px; white-space: nowrap; vertical-align: top; }
.preview-table td.wrap-cell { white-space: normal; min-width: 150px; }
.preview-table tr.is-duplicate { background: #fff1f2; opacity: 0.8; }
.preview-table tr.needs-review { background: #fffbeb; }
.preview-table tr.is-error { background: #fef2f2; }
.preview-table tr.row-edited { box-shadow: inset 3px 0 0 #2563eb; }
.editable-cell { cursor: pointer; position: relative; transition: background .12s; }
.editable-cell:hover { background: #eef5ff; outline: 1px dashed #93c5fd; outline-offset: -2px; }
.cell-edited { background: #eff6ff !important; border-left: 3px solid #2563eb; }
.orig-val { display: block; margin-top: 2px; font-size: 11px; color: #64748b; text-decoration: line-through; white-space: nowrap; }
.btn-cell-revert, .btn-row-revert { display: inline-block; margin-left: 4px; padding: 1px 5px; font-size: 10px; border-radius: 4px; border: 1px solid #cbd5e1; background: #fff; color: #334155; cursor: pointer; }
.btn-cell-revert:hover, .btn-row-revert:hover { background: #e2e8f0; }
.cell-editor-input { width: 100%; min-width: 110px; padding: 4px 6px; font-size: 12px; border: 2px solid #2563eb; border-radius: 4px; background: #fff; }
.match-mode-select { margin-top: 4px; display: block; font-size: 11px; padding: 2px 4px; border-radius: 4px; }
.tag-error { display: inline-block; padding: 2px 6px; margin: 1px 3px 1px 0; border-radius: 4px; font-size: 11px; font-weight: 700; background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.tag-edited { display: inline-block; padding: 2px 6px; margin: 1px 3px 1px 0; border-radius: 4px; font-size: 11px; font-weight: 700; background: #dbeafe; color: #1d4ed8; }
.summary-card.danger { background: #fef2f2; border-color: #fecaca; }
.summary-card.danger strong { color: #b91c1c; }

.badge-new { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #dbeafe; color: #1d4ed8; }
.badge-match { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #dcfce7; color: #15803d; }
.badge-candidate { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #fef3c7; color: #b45309; }
.badge-dup { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #fee2e2; color: #b91c1c; }
.tag-rollover { display: inline-block; padding: 1px 4px; border-radius: 3px; font-size: 10px; font-weight: 700; background: #ede9fe; color: #6d28d9; }
.btn-primary { background: #2563eb; color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-secondary:hover { background: #e2e8f0; }

/* Phase 2: Monthly Dashboard & Ad Revenue Analytics */
.dashboard-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; padding: 14px 18px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }
.month-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-month-form { display: inline-flex; align-items: end; gap: 6px; margin: 0; }
.inline-month-form label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.criteria-box { padding: 11px 16px; margin-bottom: 16px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1e3a8a; font-size: 12px; line-height: 1.5; }
.criteria-warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }

.metrics-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metrics-10 a, .metric-card { padding: 18px 16px; }
.metrics-10 strong { font-size: clamp(16px, 1.5vw, 22px); }
.analytics-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { display: grid; gap: 6px; padding: 20px 18px; border: 1px solid #edf3fb; border-radius: 16px; background: #f3f8ff; color: inherit; }
.metric-card span, .metric-card small { color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: clamp(17px, 1.6vw, 24px); letter-spacing: -.03em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.analytics-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; align-items: end; }
.analytics-filter label[hidden] { display: none !important; }
.filter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-card { margin-bottom: 0; }
.chart-card h2 small { font-size: 12px; font-weight: 500; margin-left: 4px; }
.chart-card-wide { grid-column: 1 / -1; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis { stroke: #cbd5e1; stroke-width: 1.5; }
.bar-contract { fill: #93c5fd; transition: fill .15s; }
.bar-contract.bar-active { fill: #2563eb; }
.bar-receipt { fill: #6ee7b7; transition: fill .15s; }
.bar-receipt.bar-active { fill: #059669; }
.chart-val { fill: #1e293b; font-size: 11px; font-weight: 700; }
.chart-lbl { fill: #475569; font-size: 11px; font-weight: 600; }
.chart-sub { fill: #94a3b8; font-size: 10px; }

.donut-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: center; }
.donut-svg { width: 210px; height: 210px; display: block; margin: auto; transform: rotate(-90deg); }
.donut-svg text { transform: rotate(90deg); transform-origin: 110px 110px; }
.donut-track { stroke: #e2e8f0; }
.donut-center-label { fill: #64748b; font-size: 11px; font-weight: 600; }
.donut-center-val { fill: #0f172a; font-size: 16px; font-weight: 800; }
.donut-seg { transition: opacity .15s; }
.seg-0 { stroke: #2563eb; } .seg-bg-0 { background: #2563eb; }
.seg-1 { stroke: #10b981; } .seg-bg-1 { background: #10b981; }
.seg-2 { stroke: #f59e0b; } .seg-bg-2 { background: #f59e0b; }
.seg-3 { stroke: #8b5cf6; } .seg-bg-3 { background: #8b5cf6; }
.seg-4 { stroke: #ef4444; } .seg-bg-4 { background: #ef4444; }
.seg-5 { stroke: #06b6d4; } .seg-bg-5 { background: #06b6d4; }
.seg-6 { stroke: #ec4899; } .seg-bg-6 { background: #ec4899; }
.seg-7 { stroke: #84cc16; } .seg-bg-7 { background: #84cc16; }
.seg-8 { stroke: #f97316; } .seg-bg-8 { background: #f97316; }
.seg-9 { stroke: #64748b; } .seg-bg-9 { background: #64748b; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend-table td, .legend-table th { padding: 8px 10px; }

.section-head-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.section-head-row h2 { margin: 0; }
.sort-link { color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap; }
.sort-link:hover { color: var(--accent-hover); text-decoration: underline; }
.num-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .side-panel form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .metrics-10 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 850px) {
  .app { grid-template-columns: 180px minmax(0, 1fr); }
  .metrics, .metrics-10, .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; padding: 9px 13px; gap: 7px; }
  .sidebar .brand { margin: 0; padding: 2px 0 7px; }
  .cafes, nav { display: flex; flex-wrap: wrap; align-items: center; }
  nav { margin-top: 2px; }
  nav .workspace { width: 100%; }
  .cafes a, nav a { min-height: 0; padding: 6px 8px; }
  nav a span { width: 19px; }
  .account { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; }
  .account form { margin: 0; }
  .content { padding: 13px 11px 28px; }
  section { padding: 13px; }
  .metrics { gap: 8px; }
  .metrics a { padding: 11px; }
  .side-panel form { grid-template-columns: minmax(0, 1fr); }
}


[hidden] { display: none !important; }
.events-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin: 14px 0; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.inline-title { display: inline-block; margin: 0 8px 0 6px; font-size: 18px; }
.draw-box { margin-top: 12px; padding: 12px; background: #f8fafd; border: 1px solid var(--border); border-radius: 8px; }
.compact-scroll { max-height: 280px; overflow: auto; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; }
.compact-input { width: 140px; min-width: 110px; }
.compact-num { width: 72px; }
.inline-nums { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; }
.date-stack { display: grid; gap: 4px; }
.mini-lbl { display: flex; align-items: center; gap: 4px; font-size: 12px; margin: 0; }
.mini-lbl input { width: 132px; font-size: 12px; padding: 3px 6px; }
.small-note { font-size: 11px; margin-top: 2px; }
.small-link { font-size: 12px; margin-left: 4px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; align-items: end; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.sub-panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 12px; background: #fcfdff; }
.loading-bar { padding: 10px 14px; background: #eef5ff; border: 1px solid #bfd7ff; border-radius: 7px; margin: 10px 0; color: #1d4ed8; font-weight: 600; }
.alert-error { padding: 10px 14px; background: #fff2f2; border: 1px solid #f4b8b8; border-radius: 7px; margin: 10px 0; color: #b42318; font-weight: 600; }
.upload-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.col-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 8px; margin: 10px 0; }
.col-map-grid label { font-size: 12px; display: grid; gap: 4px; }
.bulk-edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; padding: 8px 10px; background: #f8fafd; border: 1px solid var(--border); border-radius: 7px; }
.modal-table-wrap { max-height: 50vh; overflow: auto; }
.status-wait { background: #fff6e5; color: #9a5b00; border: 1px solid #f6d594; }
.status-prep { background: #eef5ff; color: #1e56b5; border: 1px solid #bfd7ff; }
.status-sent { background: #ecfdf3; color: #087443; border: 1px solid #a6f4c5; }
.status-confirm { background: #e6f9ed; color: #05603a; border: 1px solid #6ce9a6; font-weight: 700; }
.status-unknown { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; font-weight: 700; }
.winner-dup-badge { background: #fef0c7; color: #93370d; border: 1px solid #fec84b; margin-top: 3px; font-size: 11px; }
.wide-modal { max-width: 1180px; width: 96vw; }
.cell-revert-btn { margin-left: 4px; padding: 0 4px; font-size: 11px; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; cursor: pointer; }
.cell-editor { width: 100%; min-width: 84px; padding: 4px 6px; font: inherit; border: 2px solid var(--accent); border-radius: 4px; }
#event-preview-table td.editable-cell { cursor: pointer; position: relative; }
#event-preview-table td.editable-cell:hover { background: #f0f6ff; }
#event-preview-table td.cell-edited { background: #fffbeb; box-shadow: inset 0 0 0 1px #f59e0b; }
#event-preview-table td.cell-edited .orig-val { display: block; font-size: 11px; color: #92400e; }
#event-preview-table tr.row-error { background: #fff5f5; }
#event-preview-table tr.row-excluded { opacity: 0.55; }
@media (max-width: 720px) { .span-2 { grid-column: auto; } }

#trial-preview-table td.editable-cell { cursor: pointer; position: relative; }
#trial-preview-table td.editable-cell:hover { background: #f0f6ff; }
#trial-preview-table td.cell-edited { background: #fffbeb; box-shadow: inset 0 0 0 1px #f59e0b; }
#trial-preview-table td.cell-edited .orig-val { display: block; font-size: 11px; color: #92400e; }
#trial-preview-table tr.row-error { background: #fff5f5; }
#trial-preview-table tr.row-excluded { opacity: 0.55; }

.badge-draft, .tag-draft { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; font-weight: 700; padding: 2px 6px; border-radius: 5px; font-size: 11px; }
.row-inactive { opacity: 0.6; background: #f9fafb; }

/* Follow-up P2: Ad Slot Occupancy & Reservation Board */
.slot-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 12px; margin-top: 12px; }
.slot-card { display: grid; gap: 6px; align-content: start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #ffffff; }
.slot-card-free { border-left: 4px solid #16a34a; background: #fafefc; }
.slot-card-occupied { border-left: 4px solid #f59e0b; background: #fffdf5; }
.slot-card-inactive { border-left: 4px solid #94a3b8; opacity: 0.65; background: #f8fafc; }
.slot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.slot-code { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #1e293b; color: #ffffff; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.slot-meta { font-size: 12px; color: #475569; line-height: 1.45; overflow-wrap: anywhere; }

/* Follow-up P4: Ad Delivery & Banner Creative Lifecycle */
.quota-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; font-size: 13px; }
.creative-card-list { display: grid; gap: 14px; }
.creative-summary-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: start; margin: 10px 0; }
.creative-thumb { display: block; max-width: 132px; max-height: 82px; border-radius: 6px; border: 1px solid #cbd5e1; background: #f8fafc; object-fit: contain; }

/* Follow-up P3 & P6: Ad Schedule Calendar & Internal Alerts */
.cal-month-headers { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; text-align: center; font-size: 12px; font-weight: 700; color: #475569; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
.cal-day-cell { min-height: 112px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #ffffff; display: flex; flex-direction: column; gap: 5px; }
.cal-day-other { background: #f8fafc; opacity: 0.65; }
.cal-day-today { border: 2px solid var(--accent, #2563eb); background: #f4f8ff; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #1e293b; border-bottom: 1px solid #eef2f7; padding-bottom: 4px; }
.cal-day-head span { font-size: 11px; color: #64748b; }
.cal-day-events { display: grid; gap: 4px; }
.cal-pill { display: block; padding: 3px 6px; border-radius: 5px; font-size: 11px; font-weight: 600; text-decoration: none; line-height: 1.3; overflow-wrap: anywhere; border: 1px solid transparent; }
.cal-pill:hover { filter: brightness(0.95); text-decoration: underline; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.cal-ev-contract { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.cal-ev-slot { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.cal-ev-actual { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.cal-ev-hide { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.cal-ev-creative { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
.cal-ev-post { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.cal-ev-notice { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.cal-ev-trial { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.cal-ev-renewal { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.cal-more summary { font-size: 11px; color: #2563eb; cursor: pointer; }
.alert-sev-urgent { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.alert-sev-warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alert-sev-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.row-highlight { background: #f0f7ff; font-weight: 600; }

/* Follow-up P7: Operational Docs, Quotes, Reports & Print Styles */
.doc-actions-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin: 10px 0 16px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.doc-actions-bar form { margin: 0; }
.doc-paper { background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 26px 28px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); }
.doc-paper .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #1e3a8a; padding-bottom: 12px; margin-bottom: 16px; }
.doc-paper .doc-head h1 { font-size: 22px; margin: 0 0 4px; color: #0f172a; }
.doc-paper .doc-head .sub { margin: 0; color: #475569; font-size: 12px; }
.doc-paper .doc-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; background: #eff6ff; color: #1d4ed8; font-weight: 700; font-size: 12px; border: 1px solid #bfdbfe; }
.doc-paper .warn-box { padding: 10px 13px; background: #fff8e1; border: 1px solid #fcd34d; border-radius: 7px; color: #78350f; margin: 10px 0 14px; font-size: 12px; }
.doc-paper .meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.doc-paper .meta-box { padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; }
.doc-paper .meta-box h3 { margin: 0 0 8px; font-size: 13px; color: #1e3a8a; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
.doc-paper .meta-row { display: flex; justify-content: space-between; gap: 10px; margin: 4px 0; font-size: 12.5px; }
.doc-paper .meta-row span { color: #64748b; }
.doc-paper .totals-box { margin-left: auto; max-width: 340px; border: 1.5px solid #1e3a8a; border-radius: 8px; padding: 10px 14px; background: #f8fbff; margin-top: 12px; }
.doc-paper .totals-line { display: flex; justify-content: space-between; margin: 4px 0; font-size: 13px; }
.doc-paper .totals-grand { border-top: 1px solid #bfdbfe; padding-top: 6px; margin-top: 6px; font-size: 15px; font-weight: 800; color: #1e3a8a; }
.doc-paper .kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.doc-paper .kpi { border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.doc-paper .kpi span { display: block; font-size: 11px; color: #64748b; }
.doc-paper .kpi strong { font-size: 15px; color: #0f172a; }
.doc-paper .foot-note { margin-top: 14px; font-size: 12px; color: #64748b; border-top: 1px solid #e2e8f0; padding-top: 8px; }
@media print {
  .sidebar, .topbar, .no-print, .banner, .success, details { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  section { border: 0; padding: 0; margin: 0 0 12px; }
  .doc-paper { border: 0; box-shadow: none; padding: 0; }
}
