:root {
  --bg: #060d18;
  --bg-2: #091321;
  --panel: rgba(13, 22, 38, 0.96);
  --panel-2: #111b2d;
  --line: #1d2c41;
  --line-2: #27384e;
  --text: #f8fafc;
  --muted: #9eb0c7;
  --soft: #dbe8f7;
  --primary: #3cc0ff;
  --primary-2: #1f9ed9;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(28, 119, 197, .18), transparent 22%),
    radial-gradient(circle at top left, rgba(56, 189, 248, .12), transparent 20%),
    linear-gradient(180deg, #08111f 0%, #060d18 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { min-height: 100svh; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
input, select, textarea {
  width: 100%;
  background: #0b1525;
  border: 1px solid #304255;
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
}
textarea { resize: vertical; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 12px calc(env(safe-area-inset-bottom) + 24px);
}
.card, .room-panel {
  background: linear-gradient(180deg, rgba(14,24,40,.97), rgba(9,17,30,.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 16px; }
.glass { backdrop-filter: blur(10px); }
.topbar, .card-head, .room-summary-head, .modal-head, .section-bar, .room-panel-top, .expense-row-top, .block-head, .status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar { margin-bottom: 14px; align-items: flex-start; }
.topbar h1, .section-bar h2, .card-head h2, .room-summary-head h2 { margin: 4px 0 0; }
.subtle, .field span, .block-subtitle, .task-notes, .empty-state, .card-head p, .section-bar p, .room-summary-head p, .room-title-wrap p { color: var(--muted); }
.eyebrow {
  margin: 0;
  color: #7dd3fc;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.topbar-actions, .status-actions, .detail-actions, .room-actions, .actions, .task-actions, .material-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
}
.banner.warning { background: rgba(59, 130, 246, .08); }
.banner.error { background: rgba(127, 29, 29, .2); color: #fecaca; border-color: #7f1d1d; }
.auth-card { max-width: 460px; margin: 16px auto 0; }
.status-row { flex-wrap: wrap; }
.status-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  background: #0b1320;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 10px 16px;
}
.status-chip span { color: var(--muted); font-size: 12px; }
.stats-grid, .rooms-grid, .blocks-grid {
  display: grid;
  gap: 14px;
}
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rooms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.blocks-grid { grid-template-columns: 1fr; margin-top: 14px; }
.stat-card p, .stat-card small { margin: 0; color: var(--muted); }
.stat-card h3 { margin: 8px 0 4px; font-size: clamp(24px, 4vw, 34px); }
.total-card { background: linear-gradient(180deg, rgba(14,24,40,.97), rgba(8,13,23,.98)); }
.room-accent.paint { border-color: rgba(61, 193, 255, .35); }
.room-accent.polish { border-color: rgba(34, 197, 94, .35); }
.room-panel {
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.room-panel::after {
  content: '';
  position: absolute;
  inset: auto -40px -40px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,.14), transparent 70%);
}
.room-panel.active { border-color: #38bdf8; box-shadow: 0 0 0 1px rgba(56,189,248,.25), var(--shadow); }
.room-panel-top { align-items: flex-start; }
.room-head { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 0; }
.room-title-wrap h3 { margin: 0 0 4px; font-size: 24px; }
.progress-ring {
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
}
.progress-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.progress-ring .label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}
.room-latest { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.mini-expense {
  background: rgba(10, 18, 31, .92);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 12px 13px;
}
.mini-expense .meta { margin-top: 4px; color: #a8b3c7; font-size: 12px; }
.mini-expense .notes { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.progress-line {
  width: 100%;
  height: 11px;
  background: #08111d;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #1b2738;
  margin-top: 12px;
}
.progress-line > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3cc0ff, #22c55e);
  border-radius: 999px;
  transition: width .25s ease;
}
.block-card {
  background: #0c1627;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 14px;
}
.block-title { margin: 0; font-size: 18px; }
.section-title { font-size: 12px; letter-spacing: .10em; text-transform: uppercase; color: #d5e2f1; margin: 14px 0 8px; }
.task-row, .material-row, .expense-row {
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 12px;
  background: rgba(10,18,31,.92);
  margin-bottom: 8px;
}
.task-row.done, .material-row.done { opacity: .82; }
.expense-row { display: flex; flex-direction: column; gap: 8px; }
.expense-row-top { align-items: flex-start; }
.expense-meta { color: var(--muted); font-size: 13px; }
.primary, .ghost, .mini-btn, .status-btn {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 13px;
}
.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #062033;
  font-weight: 800;
}
.ghost, .mini-btn, .status-btn {
  background: #182436;
  color: #eef4fb;
  border: 1px solid #314357;
}
.ghost.danger { background: #37141a; border-color: #6b1b23; color: #fecaca; }
.status-btn.done { background: #12361f; border-color: #1f5a32; color: #bbf7d0; }
.status-btn.doing { background: #3b2509; border-color: #7c5d11; color: #fde68a; }
.status-btn.todo { background: #262f3d; border-color: #334155; color: #e2e8f0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.modal {
  width: min(100vw - 20px, 560px);
  border: 0;
  padding: 0;
  background: transparent;
}
.modal::backdrop { background: rgba(2, 8, 23, .8); }
.modal-card {
  background: linear-gradient(180deg, #101826, #09121f);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
}
.sticky-actions { padding-top: 4px; }
.icon-btn { background: transparent; color: var(--text); font-size: 18px; width: 40px; height: 40px; border-radius: 50%; }
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(2, 8, 23, .74);
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.16);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .stats-grid, .rooms-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar, .room-panel-top, .room-summary-head, .expense-row-top { flex-direction: column; align-items: stretch; }
  .topbar-actions > *, .room-actions > *, .detail-actions > *, .actions > * { flex: 1; }
  .status-row { align-items: stretch; }
  .status-chip { border-radius: 18px; }
  .room-head { align-items: flex-start; }
}
