:root {
  color-scheme: dark;
  --bg: #0c0e12;
  --bg-2: #07080b;
  --surface: #16181f;
  --surface-2: #1c2029;
  --elevated: #252a36;
  --text: #f3f5fa;
  --muted: #8d95a8;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7ee0b8;
  --accent-dim: rgba(126, 224, 184, 0.16);
  --gold: #e2c48a;
  --ok: #4ade80;
  --wait: #f5c84c;
  --warn: #ff8b7a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg-2); }
body {
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", sans-serif;
  background: var(--bg-2);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(126, 224, 184, 0.08), transparent 46%),
    radial-gradient(700px 360px at 100% 0%, rgba(226, 196, 138, 0.06), transparent 42%),
    var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + var(--safe-top)) 18px 12px;
  background: rgba(12, 14, 18, 0.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
  letter-spacing: -0.03em;
  font-size: 17px;
  flex: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #0c0e12;
  font-size: 13px;
  font-weight: 800;
}
.desk-nav { display: none; }
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}
.who { color: var(--muted); }
.text-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
}
.text-btn:hover { color: var(--text); }

.page {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 18px 28px;
  flex: 1;
}
body.is-app .page { padding-bottom: calc(28px + 72px + var(--safe-bottom)); }
.page-login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 32px 20px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 22px;
}
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
h1 { margin: 0; font-size: 28px; letter-spacing: -0.045em; }
h2 { margin: 0; font-size: 16px; letter-spacing: -0.03em; }
.lede { color: var(--muted); line-height: 1.6; }
.lede-inline { color: var(--muted); line-height: 1.65; margin: -8px 0 20px; }

.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.month-nav a {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.month-nav a:hover { background: var(--elevated); color: var(--accent); }
.month-nav span { min-width: 104px; text-align: center; font-weight: 650; font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 8px; font-size: 20px; letter-spacing: -0.04em; }
.stat em { display: block; margin-top: 4px; color: var(--muted); font-style: normal; font-size: 12px; }

.card-section { margin: 0 0 22px; }
.card-section > h2 { margin-bottom: 12px; }
.share-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px 8px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.share-block.is-solo { background: transparent; }
.share-block-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.share-block-head strong { color: var(--gold); }
.share-block .table { margin: 0; }
.btn-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 12px;
}
.pick-set {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0;
}
.pick-set legend { padding: 0 6px; color: var(--text); font-weight: 650; }
.pick-list { display: grid; gap: 8px; margin-top: 10px; }
.benefit-pick .muted { margin-left: 6px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 14px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.plastic {
  display: block;
  min-height: 168px;
  padding: 18px 18px 16px;
  border-radius: 22px;
  color: #f8f1e6;
  background: linear-gradient(145deg, #243152, #4c5d8a);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease;
}
.plastic::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.plastic h3 { margin: 18px 0 20px; font-size: 22px; letter-spacing: -0.04em; position: relative; }
.plastic-top, .plastic-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.85;
  position: relative;
}
.plastic-navy { background: linear-gradient(145deg, #1d2a4a, #3e527d); }
.plastic-ink { background: linear-gradient(145deg, #221c18, #4a433c); }
.plastic-forest { background: linear-gradient(145deg, #1c3a2e, #3e6a54); }
.plastic-wine { background: linear-gradient(145deg, #4a1d27, #7a3a46); }
.plastic-bronze { background: linear-gradient(145deg, #5c3b1f, #a07543); }
.plastic-slate { background: linear-gradient(145deg, #2a3238, #58656e); }
.plastic.is-met { outline: 2px solid var(--accent); }
.plastic.is-off { filter: grayscale(0.45); opacity: 0.72; }
@media (hover: hover) {
  .plastic:hover { transform: translateY(-2px); }
}
.remain { margin: 10px 0 0; font-size: 13px; opacity: 0.9; position: relative; }

.bar {
  height: 6px;
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
  margin-bottom: 12px;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  min-height: 40px;
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #0c0e12;
  font-weight: 700;
}
.btn-ghost {
  border-color: var(--line);
  background: transparent;
}
.btn:hover { border-color: rgba(255,255,255,0.18); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost:hover { background: var(--elevated); }

.list, .timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.list-row, .tl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child, .tl:last-child { border-bottom: 0; }
.list-row p, .tl p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.list-num { text-align: right; font-size: 13px; display: grid; gap: 2px; color: var(--gold); }
.muted { color: var(--muted); font-size: 13px; }

.tl-day {
  width: 48px;
  height: 52px;
  border-radius: 14px;
  background: var(--elevated);
  display: grid;
  place-items: center;
  flex: none;
}
.tl-day span { font-size: 20px; font-weight: 750; line-height: 1; }
.tl-day em { font-style: normal; font-size: 11px; color: var(--muted); }
.tl-body { flex: 1; min-width: 0; }
.tl-today .tl-day { background: var(--accent); color: #0c0e12; }
.tl-today .tl-day em { color: #14533d; }
.tl-overdue .tl-day { background: rgba(255, 139, 122, 0.18); color: var(--warn); }
.tl-used { opacity: 0.62; }
.tl-planned .tl-day { background: var(--accent-dim); color: var(--accent); }
.timeline-wide .tl { padding: 14px 0; align-items: flex-start; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.filter-select {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 18px;
  max-width: 520px;
}
.filter-select label { margin: 0; flex: 1; min-width: 160px; }
.panel .filter-select { margin: 0 0 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--elevated);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.chip.is-on {
  background: var(--accent-dim);
  color: var(--accent);
}
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--elevated);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.tag-ok { background: rgba(74, 222, 128, 0.16); color: var(--ok); }
.tag-wait { background: rgba(245, 200, 76, 0.18); color: var(--wait); }
.tag-warn { background: rgba(255, 139, 122, 0.16); color: var(--warn); }
.status-reason { margin-left: 6px; }
tr.is-status-done > td:first-child,
.list-row.is-status-done,
.share-block.is-status-done { box-shadow: inset 3px 0 0 var(--ok); }
tr.is-status-open > td:first-child,
.list-row.is-status-open,
.share-block.is-status-open { box-shadow: inset 3px 0 0 var(--wait); }
tr.is-status-blocked > td:first-child,
.list-row.is-status-blocked,
.share-block.is-status-blocked { box-shadow: inset 3px 0 0 var(--warn); }
.share-block.is-status-done { border-color: rgba(74, 222, 128, 0.35); }
.share-block.is-status-open { border-color: rgba(245, 200, 76, 0.35); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table .tag { margin-left: 0; }
.table th { color: var(--muted); font-size: 11px; font-weight: 650; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.is-dim { opacity: 0.55; }
.empty { color: var(--muted); padding: 12px 0 4px; }
.more { margin: 14px 0 0; }
.more a { color: var(--accent); font-weight: 650; }

.form-card, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px 20px;
  max-width: 640px;
}
.login-wrap { width: min(400px, 92vw); }
.login-card h1 { margin-bottom: 8px; }
.login-card .btn-primary { width: 100%; margin-top: 6px; }
.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr; gap: 14px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
.form-card label .muted { font-weight: 400; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--elevated);
  border-radius: 12px;
  padding: 12px 12px;
  color-scheme: dark;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.danger-row { margin-top: 16px; }
.danger-row .text-btn { color: var(--warn); }
.danger-row .text-btn:hover { color: var(--text); }
.inline-form { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.inline-form input { max-width: 220px; }
.perf-link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child .perf-link { border-bottom: 0; }
.perf-link:hover strong { color: var(--accent); }
.perf-main { min-width: 0; flex: 1; }
.perf-main p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.memo-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 12px 14px; border-radius: 12px; background: var(--elevated); }
.flash-ok { background: var(--accent-dim); color: var(--ok); }
.flash-error { background: rgba(255, 139, 122, 0.16); color: var(--warn); }

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(8px + var(--safe-bottom));
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.tabbar a {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  border-radius: 14px;
}
.tabbar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a.is-on {
  color: var(--accent);
  background: var(--accent-dim);
}

@media (max-width: 859px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .head-actions { width: 100%; }
  h1 { font-size: 26px; }
  .table { display: block; overflow-x: auto; }
  .tl { flex-wrap: wrap; }
}

@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { gap: 12px; }
  .stat strong { font-size: 22px; }
}

@media (min-width: 860px) {
  .desk-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
  }
  .desk-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
  }
  .desk-nav a:hover { color: var(--text); background: var(--elevated); }
  .desk-nav a.is-on {
    color: var(--accent);
    background: var(--accent-dim);
  }

  .tabbar { display: none; }
  body.is-app .page { padding: 28px 28px 48px; padding-bottom: 48px; }
  .app-header { padding: 12px 28px; }

  h1 { font-size: 32px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .split { grid-template-columns: 1fr 1fr; gap: 18px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .two { grid-template-columns: 1fr 1fr; }
  .form-card { max-width: 720px; padding: 28px; }
  .panel { padding: 22px; }
}

@media (min-width: 1200px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (display-mode: standalone) {
  .app-header { padding-top: calc(8px + var(--safe-top)); }
}
