:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --text: #0f172a;
    --muted: #64748b;
    --faint: #94a3b8;

    --border: #e2e8f0;

    --primary: #0f172a;
    --primary-soft: #e2e8f0;

    --success-bg: #dcfce7;
    --success-text: #166534;

    --warning-bg: #fef3c7;
    --warning-text: #92400e;

    --danger-bg: #fee2e2;
    --danger-text: #991b1b;

    --muted-bg: #e2e8f0;
    --muted-text: #475569;

    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 4px 16px rgba(15, 23, 42, 0.06);

    --bottom-nav-height: 72px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* -------------------------------------------------------
   Auth Screen
------------------------------------------------------- */

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #dbeafe 0, transparent 32%),
        radial-gradient(circle at bottom right, #e0e7ff 0, transparent 32%),
        var(--bg);
}

.auth-shell {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
}

.brand-block {
    margin-bottom: 28px;
    text-align: center;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    border-radius: 18px;
    color: #ffffff;
    background: var(--primary);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: var(--shadow-soft);
}

.brand-block h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.brand-block p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}

.field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
}

.alert-error {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.demo-hint {
    margin-top: 20px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 13px;
    text-align: center;
}

.demo-hint strong,
.demo-hint span {
    display: block;
    margin-top: 4px;
    color: var(--text);
}

/* -------------------------------------------------------
   App Shell
------------------------------------------------------- */

.app-screen {
    background:
        linear-gradient(180deg, #eef2ff 0, #f8fafc 220px, var(--bg) 100%);
}

.app-shell {
    width: 100%;
    max-width: 560px;
    min-height: 100vh;
    margin: 0 auto;
    position: relative;
    background: transparent;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding:
        calc(18px + env(safe-area-inset-top))
        18px
        14px;
    background: rgba(248, 250, 252, 0.84);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.72);
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-header h1 {
    margin: 3px 0 0;
    font-size: 25px;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface);
    font-size: 13px;
    font-weight: 700;
}

.app-main {
    padding: 16px 16px calc(var(--bottom-nav-height) + 28px);
}

/* -------------------------------------------------------
   Cards / Sections
------------------------------------------------------- */

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.welcome-card.compact {
    padding: 16px 18px;
}

.welcome-card h2 {
    margin: 2px 0 0;
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -0.03em;
}

.muted {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.client-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--success-text);
    background: var(--success-bg);
    font-size: 12px;
    font-weight: 800;
}

.muted-chip {
    color: var(--muted-text);
    background: var(--muted-bg);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.stat-card small {
    display: block;
    margin-top: 6px;
    color: var(--faint);
    font-size: 12px;
    font-weight: 650;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 2px 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.section-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* -------------------------------------------------------
   Tender Cards
------------------------------------------------------- */

.tender-list {
    display: grid;
    gap: 14px;
}

.tender-card {
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.expired-card {
    opacity: 0.94;
}

.tender-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.tender-no {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

.badge-success {
    color: var(--success-text);
    background: var(--success-bg);
}

.badge-warning {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.badge-danger {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.badge-muted {
    color: var(--muted-text);
    background: var(--muted-bg);
}

.tender-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.28;
    letter-spacing: -0.025em;
}

.authority,
.department {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.department {
    margin-top: 3px;
    color: var(--faint);
}

.tender-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.tender-meta.single {
    grid-template-columns: 1fr;
}

.tender-meta div {
    padding: 12px;
    border-radius: 14px;
    background: var(--surface-soft);
}

.tender-meta span {
    display: block;
    color: var(--faint);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tender-meta strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.2;
}

/* -------------------------------------------------------
   Buttons
------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.btn-secondary {
    color: var(--text);
    background: var(--primary-soft);
}

.btn:active {
    transform: translateY(1px);
}

/* -------------------------------------------------------
   Empty State
------------------------------------------------------- */

.empty-state {
    display: grid;
    place-items: center;
    min-height: 280px;
    padding: 28px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    border-radius: 18px;
    color: #ffffff;
    background: var(--primary);
    font-size: 15px;
    font-weight: 850;
}

.empty-state h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.empty-state p {
    max-width: 280px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

/* -------------------------------------------------------
   Bottom Navigation
------------------------------------------------------- */

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 560px;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 16px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.bottom-nav a span {
    font-size: 13px;
    line-height: 1;
}

.bottom-nav a.active {
    color: var(--text);
    background: var(--primary-soft);
}

/* -------------------------------------------------------
   Toast
------------------------------------------------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bottom-nav-height) + 20px);
    z-index: 50;
    width: calc(100% - 32px);
    max-width: 420px;
    padding: 13px 16px;
    transform: translateX(-50%);
    border-radius: 999px;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: var(--shadow-card);
    font-size: 14px;
    font-weight: 750;
    text-align: center;
}

/* -------------------------------------------------------
   Desktop polish
------------------------------------------------------- */

@media (min-width: 720px) {
    body {
        background:
            radial-gradient(circle at top, #e0e7ff 0, transparent 32%),
            var(--bg);
    }

    .app-shell {
        min-height: 100vh;
    }

    .app-main {
        padding-left: 20px;
        padding-right: 20px;
    }

    .tender-card,
    .welcome-card,
    .stat-card,
    .empty-state {
        border-color: rgba(203, 213, 225, 0.9);
    }
}

/* -------------------------------------------------------
   Reduced motion
------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
    }
}