:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #111827;
    --accent: #f97316;
    --accent-ink: #ffffff;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.app-shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; font-size: 14px; letter-spacing: .5px;
}
.brand-text { font-size: 16px; }

/* Main */
.app-main {
    flex: 1;
    padding: 16px;
    padding-bottom: 96px;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 520px;
    display: flex; justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 8px 4px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 30;
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--muted); flex: 1; padding: 4px 0;
}
.bottom-nav a .ico { font-size: 20px; }
.bottom-nav a.active { color: var(--ink); font-weight: 600; }
.bottom-nav a.nav-cta { color: var(--accent-ink); }
.bottom-nav a.nav-cta .ico {
    background: var(--accent); color: #fff;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; margin-top: -18px;
    box-shadow: var(--shadow); font-size: 24px;
}
.bottom-nav a.nav-cta span:last-child { color: var(--muted); }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }

.section-title {
    font-size: 14px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); margin: 20px 4px 10px; font-weight: 600;
}
h1.page-title { font-size: 22px; margin: 4px 4px 16px; }

/* Pills / badges */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #e5e7eb; color: #374151; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px; border-radius: 12px; border: none;
    font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
    background: var(--primary); color: #fff;
}
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-danger  { background: var(--danger); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-sm { padding: 8px 12px; font-size: 13px; width: auto; }
.btn-row { display: flex; gap: 8px; }
.btn-row form { flex: 1; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input, select, textarea {
    width: 100%; padding: 12px 14px; font-size: 16px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input[type="checkbox"] { width: auto; transform: scale(1.3); margin-right: 8px; }
textarea { min-height: 80px; resize: vertical; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline > div { flex: 1; min-width: 120px; }
.check-row { display: flex; align-items: center; gap: 4px; margin: 12px 0; }
.check-row label { margin: 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Flash messages */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }

/* Lists */
.list-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 13px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lbl { font-size: 12px; color: var(--muted); }

/* Price */
.price { font-size: 20px; font-weight: 800; }
.price small { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .ico { font-size: 40px; display: block; margin-bottom: 8px; }

/* Hero (landing) */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 28px; margin: 8px 0; }
.hero p { color: var(--muted); margin: 0 0 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.center { text-align: center; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
