/* Shared paper-studio styles for the sponsor portal and the control center. */
:root {
  --paper: #f5f7f0;
  --card: #ffffff;
  --ink: #151814;
  --muted: #52645c;
  --faint: #8a968f;
  --line: #d9e0d8;
  --line-soft: #e9eee7;
  --accent: #0b7d62;
  --accent-soft: #e3f1ec;
  --warn: #9a5b00;
  --warn-soft: #fbf1dc;
  --danger: #a3321f;
  --danger-soft: #fbe9e5;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Pretendard", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 28px 18px 64px; }
main { width: min(1120px, 100%); margin: 0 auto; }
main.narrow { width: min(420px, 100%); padding-top: 8vh; }

h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); line-height: 1.08; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
p { margin: 0; color: var(--muted); }
a { color: var(--accent); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }

.masthead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.masthead .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.date-range { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.date-range input[type="date"] { min-height: 30px; padding: 2px 6px; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 12.5px; }
.date-range span { color: var(--faint); font-size: 12px; }

.panel { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.panel > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel > header p { font-size: 13px; }

.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 20px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.fields { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.two > .panel { margin-top: 0; }

.kpi { padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .label small { color: var(--faint); font-size: 12px; }
.kpi .value { margin-top: 6px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover { border-color: #b9c4ba; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { border-color: var(--ink); background: var(--ink); color: #fff; }
button.primary:hover { background: #2a2f29; }
button.danger { color: var(--danger); }
button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label.field { display: grid; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.tabs { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.tabs button { min-height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.banner { margin-top: 16px; padding: 11px 14px; border: 1px solid; border-radius: 8px; font-size: 14px; }
.banner.error { border-color: #ecc4bb; background: var(--danger-soft); color: var(--danger); }
.banner.ok { border-color: #bfe0d5; background: var(--accent-soft); color: #075c48; }
.banner.warn { border-color: #ecd9ae; background: var(--warn-soft); color: var(--warn); }

.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
th:first-child, td:first-child, th.text, td.text { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--faint); font-size: 12px; }
td.empty { padding: 22px 10px; color: var(--faint); text-align: center; }
.share { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: var(--line-soft); }
.share > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; }
.pill.on { background: var(--accent-soft); color: #075c48; }
.pill.off { background: #eceeea; color: var(--faint); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.switch { position: relative; display: inline-flex; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { width: 100%; border-radius: 999px; background: #c9d1c9; transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: 0.5; }
.switch.big { width: 64px; height: 36px; }
.switch.big span::after { width: 30px; height: 30px; }
.switch.big input:checked + span::after { transform: translateX(28px); }

.chart-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--paper); }
.chart-summary div { font-size: 12px; color: var(--muted); }
.chart-summary b { display: block; margin-top: 2px; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }

.chart-bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 210px; padding: 12px 4px 0; }
.chart-col { flex: 1 1 0; max-width: 80px; min-width: 28px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.bar-nums { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.bar-val { font-size: 11.5px; font-weight: 700; color: var(--ink); }
.bar-clicks { font-size: 10.5px; font-weight: 600; color: var(--accent); }
.bar-track { position: relative; width: 100%; flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; min-height: 24px; }
.bar-fill { width: min(38px, 100%); min-height: 4px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #0b7d62 0%, rgba(11, 125, 98, 0.72) 100%); transition: opacity 0.15s; }
.chart-col:hover .bar-fill, .chart-col:focus-visible .bar-fill { opacity: 1; box-shadow: 0 0 0 2px var(--accent-soft); }
.bar-dot { position: absolute; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--ink); border: 1.5px solid #fff; }
.bar-date { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.chart .bar { position: relative; flex: 1 1 0; min-width: 3px; height: 100%; display: flex; align-items: flex-end; cursor: pointer; background: transparent; border: 0; padding: 0; min-height: 0; border-radius: 0; }
.chart .bar i { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); opacity: 0.85; }
.chart .bar:hover i, .chart .bar:focus-visible i { opacity: 1; background: var(--ink); }
.chart .bar b { position: absolute; left: 50%; bottom: 0; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ink); }
.chart-focus { margin-top: 8px; padding: 7px 10px; border-radius: 6px; background: var(--paper); color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; background: var(--accent); }
.legend i.dot { border-radius: 50%; background: var(--ink); }

.contract-card { margin-top: 20px; padding: 18px; border: 1px solid #bfe0d5; border-left: 4px solid var(--accent); border-radius: 10px; background: var(--card); }
.contract-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.contract-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.contract-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.contract-nums { text-align: right; font-variant-numeric: tabular-nums; }
.contract-nums strong { font-size: 24px; color: var(--ink); letter-spacing: -0.02em; }
.contract-nums span { margin-left: 6px; font-size: 13px; color: var(--muted); }
.progress-track { height: 10px; margin-top: 12px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0b7d62 0%, #14a07f 100%); transition: width 0.25s ease; }
.contract-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.contract-pace { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.contract-pace > div { min-width: 0; display: grid; justify-items: start; align-content: start; gap: 5px; }
.contract-pace > div > span { color: var(--muted); font-size: 12px; }
.contract-pace strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pace-note { margin-top: 12px; font-size: 12px; }
.attainment-svg { display: block; width: 100%; height: auto; overflow: visible; }
.attainment-grid { stroke: var(--line-soft); stroke-width: 1; }
.attainment-label { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.attainment-area { fill: var(--accent); fill-opacity: 0.12; }
.attainment-line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.attainment-target { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 6 5; }
.attainment-goal { fill: var(--warn); font-size: 13px; font-weight: 600; }
.attainment-node { fill: var(--accent); stroke: #fff; stroke-width: 1.5; cursor: pointer; }
.attainment-node:hover, .attainment-node:focus-visible { fill: var(--ink); stroke: var(--accent); stroke-width: 3; outline: none; r: 6; }
.channel-share { margin-bottom: 16px; }
.channel-track { display: flex; height: 10px; border-radius: 999px; overflow: hidden; }
.channel-track > span { height: 100%; min-width: 0; }
.channel-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.channel-legend > span { min-width: 0; overflow-wrap: anywhere; }
.channel-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; }
.share-empty { margin-bottom: 14px; color: var(--muted); font-size: 13px; }

.creative-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.creative-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); min-width: 0; }
.creative-native { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #1c1917; color: #f6f2ec; }
.creative-icon { position: relative; width: 42px; height: 42px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, 0.14); display: grid; place-items: center; font-weight: 700; font-size: 17px; overflow: hidden; }
.creative-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.creative-copy { flex: 1; min-width: 0; }
.creative-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; }
.creative-head span:first-child { white-space: nowrap; }
.creative-badge { padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); color: #e5ded5; font-size: 10.5px; font-weight: 600; }
.creative-tagline { margin-top: 2px; font-size: 12.5px; color: #d6cfc7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creative-cta { flex: none; padding: 8px 12px; border-radius: 8px; background: #f6f2ec; color: #1c1917; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.creative-meta { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

@media (max-width: 820px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: minmax(0, 1fr); }
  .chart-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .creative-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  body { padding: 18px 12px 48px; }
  .panel { padding: 14px; }
  th, td { padding: 7px 6px; font-size: 12.5px; }
  .chart-bars { gap: 4px; overflow-x: auto; }
  .contract-nums { text-align: left; }
  .creative-native { flex-wrap: wrap; }
  .creative-cta { width: 100%; text-align: center; }
  .contract-pace { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .masthead, .masthead .actions, .date-range, .panel, .grid > * { min-width: 0; max-width: 100%; }
  .date-range input[type="date"] { min-width: 0; max-width: 100%; }
  .chart-focus { overflow-wrap: anywhere; }
  .attainment-label { font-size: 22px; }
  .attainment-goal { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .switch span, .switch span::after, .progress-fill, .bar-fill { transition: none; }
}
@media print {
  @page { margin: 14mm; }
  body { padding: 0; background: #fff; }
  main { width: 100%; }
  .no-print { display: none !important; }
  .panel, .kpi, .contract-card, .creative-card { break-inside: avoid; box-shadow: none; }
  .creative-native { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .attainment-svg, .channel-share, .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible; }
  th, td { white-space: normal; overflow-wrap: anywhere; }
}
