@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --blue: #2563eb;
  --green: #137333;
  --red: #b31412;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f7fb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 0%, rgba(37, 99, 235, .07), transparent 24%),
    var(--bg);
}
button, input, select { font: inherit; }
input, select { font-size: 16px !important; }
button { cursor: pointer; }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: #7c8798; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-size: 28px; letter-spacing: -.035em; }

.btn { border: 0; border-radius: 8px; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 700; transition: .15s ease; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { color: white; background: var(--blue); box-shadow: 0 5px 12px rgba(37,99,235,.18); }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn-outline { color: #475569; background: white; border: 1px solid #dbe1ea; }
.btn-outline:hover { border-color: #aeb8c7; background: #f8fafc; }
.btn-danger-soft { color: #dc2626; background: #fff0f0; border: 1px solid #ffd8d8; }
.btn-danger { color: white; background: #dc2626; }
.plus { font-size: 20px; line-height: 1; font-weight: 400; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.summary-card { min-height: 108px; background: white; border: 1px solid #edf0f4; border-radius: 12px; display: flex; align-items: center; gap: 14px; padding: 20px; box-shadow: 0 5px 20px rgba(31,41,55,.04); position: relative; overflow: hidden; }
.summary-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.card-blue::before { background: #3b82f6; } .card-green::before { background: #22c55e; } .card-orange::before { background: #f59e0b; }
.summary-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.summary-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card-blue .summary-icon { background: #eaf2ff; color: #2563eb; } .card-green .summary-icon { background: #eaf8ef; color: #16a34a; } .card-orange .summary-icon { background: #fff4df; color: #d97706; }
.summary-card p { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.summary-card strong { font-size: 21px; letter-spacing: -.02em; }

.workspace-card { background: white; border: 1px solid #edf0f4; border-radius: 12px; box-shadow: 0 8px 28px rgba(31,41,55,.055); overflow: hidden; }
.toolbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar h2 { margin: 0 0 4px; font-size: 15px; }
.toolbar p { margin: 0; color: #9ca3af; font-size: 11px; }
.toolbar-actions { display: flex; gap: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
thead th { height: 42px; background: #f8fafc; color: #64748b; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .035em; border-bottom: 1px solid var(--line); padding: 0 12px; }
.col-stt { width: 64px; text-align: center; } .col-status { width: 145px; } .col-money { width: 210px; } .col-action { width: 74px; text-align: center; }
tbody td { height: 58px; border-bottom: 1px solid #edf0f4; padding: 8px 12px; }
tbody tr { transition: background .12s; } tbody tr:hover { background: #fbfdff; }
.row-number { text-align: center; color: #94a3b8; font-size: 12px; }
.category-input, .money-input { width: 100%; height: 38px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); padding: 0 10px; outline: none; }
.category-input:hover, .money-input:hover { border-color: #e2e8f0; }
.category-input:focus, .money-input:focus { border-color: #93b4fb; box-shadow: 0 0 0 3px #eef4ff; background: white; }
.category-input::placeholder { color: #b0b7c2; }
.status-select { width: 100%; height: 34px; border-radius: 17px; border: 0; padding: 0 32px 0 12px; font-size: 12px; font-weight: 700; outline: none; appearance: none; background-position: right 11px center; background-repeat: no-repeat; background-size: 12px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.status-select.status-empty { background-color: #eef0f3; color: #6b7280; }
.status-select.status-done { background-color: var(--green); color: white; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.status-select.status-notdone { background-color: var(--red); color: white; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.status-select option { background: white; color: #374151; }
.money-cell { position: relative; }
.money-input { text-align: right; font-weight: 600; }
.delete-btn { width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: #a1a8b3; display: grid; place-items: center; margin: auto; }
.delete-btn:hover { background: #fff1f2; color: #dc2626; }
.delete-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
 .mobile-action-bar { display: none; }
.totals-strip { display: grid; grid-template-columns: repeat(3, 1fr); background: #fafbfc; border-top: 1px solid var(--line); }
.totals-strip div { min-height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-right: 1px solid var(--line); }
.totals-strip div:last-child { border-right: 0; }
.totals-strip span { color: #737d8a; font-size: 12px; }
.totals-strip strong { font-size: 14px; } .green-text { color: var(--green); } .orange-text { color: #d97706; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #172033; color: white; border-radius: 8px; padding: 11px 16px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.18); transition: .25s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confirm-dialog { border: 0; border-radius: 14px; width: min(390px, calc(100% - 32px)); padding: 0; box-shadow: 0 20px 60px rgba(15,23,42,.22); }
.confirm-dialog::backdrop { background: rgba(15,23,42,.38); backdrop-filter: blur(2px); }
.confirm-dialog form { padding: 26px; text-align: center; }
.dialog-icon { width: 48px; height: 48px; border-radius: 50%; background: #fff0f0; color: #dc2626; display: grid; place-items: center; margin: 0 auto 12px; }
.dialog-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.confirm-dialog h3 { margin: 0 0 8px; font-size: 18px; } .confirm-dialog p { margin: 0 auto 20px; color: #718096; font-size: 13px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: center; gap: 8px; }

@media (max-width: 767px) {
  body { background: #f4f7fb; }
  .app-shell { width: calc(100% - 24px); padding: 16px 0 140px; }
  .topbar { align-items: flex-start; } h1 { font-size: 22px; }
  .topbar-actions .btn { width: 42px; padding: 0; font-size: 0; }
  .summary-grid { grid-template-columns: 1fr; gap: 8px; }
  .summary-card { min-height: 78px; padding: 12px 14px; } .summary-card strong { font-size: 18px; }
  .summary-icon { width: 38px; height: 38px; }
  .toolbar { padding: 14px; } .toolbar-actions { display: none; }

  .table-wrap { overflow: visible; padding: 10px; background: #f8fafc; }
  table, tbody { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    width: 100%;
    background: white;
    border: 1px solid #e5eaf1;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 12px rgba(31,41,55,.035);
  }
  tbody td { height: auto; border: 0; padding: 0; }
  tbody td.row-number {
    grid-row: 1 / 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #edf4ff;
    color: #2563eb;
    display: grid;
    place-items: center;
    font-weight: 800;
  }
  tbody td:nth-child(2) { grid-column: 2; }
  tbody td:nth-child(3) { grid-column: 1 / -1; }
  tbody td:nth-child(4) { grid-column: 1 / -1; }
  tbody td:nth-child(5) { grid-column: 1 / -1; }
  .category-input, .money-input, .status-select { width: 100%; height: 46px; }
  .category-input, .money-input { border: 1px solid #dfe5ec; background: #fff; }
  .category-input { font-size: 16px; }
  .money-input { text-align: left; }
  .status-select { border-radius: 8px; }
  .delete-btn { width: 100%; height: 42px; border: 1px solid #fee2e2; background: #fff7f7; color: #dc2626; }

  .mobile-action-bar {
    position: fixed;
    z-index: 15;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96);
    border-top: 1px solid #e4e7ec;
    box-shadow: 0 -6px 24px rgba(31,41,55,.08);
    backdrop-filter: blur(10px);
  }
  .mobile-action-bar .btn { width: 100%; height: 46px; }

  .totals-strip { grid-template-columns: 1fr; }
  .totals-strip div { min-height: 48px; border-right: 0; border-bottom: 1px solid var(--line); }
  .totals-strip div:last-child { border-bottom: 0; }
  .save-status { bottom: 118px; }
}

.save-status {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 12;
  color: #7c8798;
  background: rgba(255,255,255,.92);
  border: 1px solid #e8ecf2;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: 0 4px 12px rgba(31,41,55,.06);
}
