:root {
  --ink: #15231d;
  --muted: #68736e;
  --line: #dfe5e1;
  --paper: #f4f6f2;
  --card: #ffffff;
  --forest: #102b22;
  --forest-2: #1d493a;
  --lime: #c8ef75;
  --lime-soft: #edf8d2;
  --red: #b94238;
  --amber: #a56816;
  --shadow: 0 16px 50px rgba(25, 48, 39, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: #708078; font-size: 11px; font-weight: 800; letter-spacing: .16em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 75% 20%, rgba(200,239,117,.24), transparent 34%), linear-gradient(135deg, #0e251d 0%, #183a2e 55%, #10231c 100%); }
.login-card { width: min(440px, 100%); padding: 46px; border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: rgba(255,255,255,.97); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.login-mark, .brand-mark { display: grid; place-items: center; color: var(--forest); background: var(--lime); font-weight: 900; }
.login-mark { width: 56px; height: 56px; margin-bottom: 30px; border-radius: 18px; font-size: 24px; transform: rotate(-3deg); }
.login-card h1 { margin: 0; font-size: 36px; letter-spacing: -.04em; }
.login-copy { margin: 12px 0 30px; color: var(--muted); line-height: 1.65; }
.login-card form { display: grid; gap: 17px; }
.login-card label { display: grid; gap: 8px; color: #47534e; font-size: 13px; font-weight: 800; }
.login-card input { width: 100%; height: 52px; padding: 0 16px; border: 1px solid #d6ddd9; border-radius: 12px; outline: none; background: #fafbf9; transition: .18s; }
.login-card input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(29,73,58,.10); background: white; }
.primary-button { height: 54px; margin-top: 4px; border: 0; border-radius: 13px; color: white; background: var(--forest); font-weight: 900; }
.primary-button:hover { background: var(--forest-2); }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: 13px; font-weight: 700; }
.login-note { margin: 18px 0 0; color: #8a938f; font-size: 12px; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 27px 18px 22px; color: #eaf1ed; background: var(--forest); }
.brand { display: flex; align-items: center; gap: 13px; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand span { margin-top: 2px; color: #91a49b; font-size: 11px; }
nav { display: grid; gap: 6px; margin-top: 24px; }
nav button { display: flex; align-items: center; gap: 13px; width: 100%; padding: 13px 14px; border: 0; border-radius: 11px; color: #aebdb6; background: transparent; text-align: left; font-weight: 750; }
nav button span { color: #61786e; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
nav button:hover { color: white; background: rgba(255,255,255,.06); }
nav button.active { color: var(--forest); background: var(--lime); }
nav button.active span { color: #50702d; }
.future-menu { display: grid; gap: 8px; margin-top: 28px; padding: 18px 14px; border-top: 1px solid rgba(255,255,255,.09); }
.future-menu p { margin: 0 0 2px; color: #6f887d; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.future-menu span { color: #81948b; font-size: 13px; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 15px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.035); }
.read-only-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(200,239,117,.1); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { margin-top: 2px; color: #81958b; font-size: 10px; }

main { min-width: 0; }
.topbar { min-height: 104px; display: flex; align-items: center; gap: 18px; padding: 22px clamp(24px,4vw,54px); border-bottom: 1px solid var(--line); background: rgba(244,246,242,.92); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font-size: clamp(25px,2.4vw,34px); letter-spacing: -.045em; }
.top-actions { display: flex; align-items: center; gap: 11px; margin-left: auto; }
.month-picker { display: flex; align-items: center; gap: 9px; height: 45px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; font-size: 12px; font-weight: 800; }
.month-picker select { border: 0; outline: none; color: var(--ink); background: transparent; font-weight: 900; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 5px; }
.user-chip > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--forest); background: var(--lime-soft); font-weight: 900; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: 12px; }
.user-chip small { margin-top: 1px; color: #87918c; font-size: 10px; }
.ghost-button, .menu-toggle { border: 1px solid var(--line); color: #4d5a54; background: white; }
.ghost-button { height: 40px; padding: 0 13px; border-radius: 10px; font-size: 12px; font-weight: 800; }
.menu-toggle { display: none; width: 42px; height: 42px; border-radius: 10px; }

.status-strip { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 clamp(24px,4vw,54px); border-bottom: 1px solid #dce7cf; color: #46622c; background: var(--lime-soft); font-size: 12px; }
.status-strip.stale { color: #80530f; background: #fff3d9; border-color: #f0deb6; }
.status-light { width: 7px; height: 7px; border-radius: 50%; background: #7dac38; }
.status-strip.stale .status-light { background: #cc841b; }
#sync-copy { color: #71825f; }

.page { padding: 32px clamp(24px,4vw,54px) 70px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-tag { padding: 7px 10px; border-radius: 999px; color: #426026; background: var(--lime-soft); font-size: 11px; font-weight: 900; }
.loading-card, .empty-state { min-height: 220px; display: grid; place-items: center; border: 1px dashed #ccd5d0; border-radius: 18px; color: var(--muted); background: rgba(255,255,255,.55); }
.empty-state { align-content: center; gap: 7px; }
.empty-state span { font-size: 12px; }

.alert-list { display: grid; gap: 8px; margin-bottom: 20px; }
.alert { padding: 12px 15px; border: 1px solid #f0d9ad; border-radius: 11px; color: #7c5415; background: #fff7e7; font-size: 12px; font-weight: 750; }
.kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card { min-height: 144px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: var(--shadow); }
.kpi-card.featured { color: white; background: var(--forest); border-color: var(--forest); }
.kpi-label { display: flex; justify-content: space-between; color: #77827d; font-size: 12px; font-weight: 800; }
.featured .kpi-label { color: #a8bbb2; }
.kpi-value { margin-top: 22px; font-size: clamp(25px,2.4vw,34px); font-weight: 900; letter-spacing: -.045em; }
.kpi-sub { margin-top: 7px; color: #8c9691; font-size: 11px; }
.featured .kpi-sub { color: #94aaa0; }
.kpi-card .arrow { color: #9ea8a3; }
.featured .arrow { color: var(--lime); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(330px,.65fr); gap: 18px; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.chart { height: 255px; display: flex; align-items: flex-end; gap: 11px; padding-top: 24px; }
.bar-group { min-width: 0; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bars { width: 100%; flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: min(15px,38%); min-height: 2px; border-radius: 5px 5px 2px 2px; background: #cbd4cf; }
.bar.billed { background: var(--forest-2); }
.bar.paid { background: var(--lime); }
.bar-label { color: #83908a; font-size: 9px; white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.chart-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; background: var(--forest-2); }
.chart-legend span:last-child::before { background: var(--lime); }

.product-list { display: grid; gap: 12px; }
.product-row { display: grid; grid-template-columns: 76px minmax(0,1fr) auto; align-items: center; gap: 12px; }
.product-row strong { font-size: 13px; }
.product-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf0ed; }
.product-track span { display: block; height: 100%; border-radius: inherit; background: var(--forest-2); }
.product-row:nth-child(2) .product-track span { background: #7da846; }
.product-row:nth-child(3) .product-track span { background: #b3cf74; }
.product-row b { font-size: 13px; }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 13px 15px; color: #77837d; background: #f7f8f6; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 900; letter-spacing: .04em; text-align: left; }
td { padding: 14px 15px; border-bottom: 1px solid #edf0ee; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfa; }
.right { text-align: right; }
.money { font-variant-numeric: tabular-nums; font-weight: 800; }
.money.negative { color: var(--red); }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.badge.active, .badge.ready { color: #395a21; background: var(--lime-soft); }
.badge.closed { color: #7b625d; background: #f1ebe9; }
.badge.legal, .badge.warning { color: #8a5710; background: #fff0d3; }
.badge.info { color: #3d5d74; background: #e8f1f7; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 14px; }
.search-input { min-width: 230px; height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: white; }
.search-input:focus { border-color: var(--forest-2); }
.metric-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; margin-bottom: 18px; }
.mini-metric { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.mini-metric span, .mini-metric strong { display: block; }
.mini-metric span { color: var(--muted); font-size: 11px; }
.mini-metric strong { margin-top: 8px; font-size: 21px; letter-spacing: -.03em; }
.invoice-notice { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 14px; padding: 18px; margin-bottom: 18px; border: 1px solid #d9e7c8; border-radius: 15px; background: #f4fae8; }
.invoice-notice > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--forest); background: var(--lime); font-weight: 900; }
.invoice-notice strong, .invoice-notice small { display: block; }
.invoice-notice small { margin-top: 5px; color: #68765d; line-height: 1.5; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .user-chip { display: none; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 252px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .topbar { min-height: 88px; padding: 16px; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 24px; }
  .top-actions { gap: 5px; }
  .ghost-button { display: none; }
  .month-picker { height: 40px; padding: 0 8px; }
  .month-picker > span { display: none; }
  .status-strip { padding: 9px 16px; flex-wrap: wrap; }
  #sync-copy { width: 100%; margin-left: 16px; }
  .page { padding: 22px 16px 50px; }
  .kpi-grid, .metric-row { grid-template-columns: 1fr 1fr; }
  .kpi-card { min-height: 124px; padding: 17px; }
  .kpi-value { margin-top: 18px; font-size: 25px; }
  .panel { padding: 17px; }
  .chart { height: 210px; gap: 6px; }
}

@media (max-width: 470px) {
  .login-card { padding: 34px 24px; }
  .kpi-grid, .metric-row { grid-template-columns: 1fr; }
  .month-picker { border: 0; background: transparent; }
  .topbar { gap: 10px; }
  .topbar h1 { font-size: 21px; }
}
