:root {
    --red: #c62828;
    --red-dark: #8b1e1e;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --soft: #f6f7fb;
    --white: #ffffff;
    --green: #15803d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: #e9edf3;
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.phone-shell {
    width: min(100%, 480px);
    min-height: 100vh;
    margin: 0 auto;
    background: var(--soft);
    position: relative;
    box-shadow: 0 18px 60px rgba(15, 23, 42, .16);
}

.app-header {
    min-height: 138px;
    padding: 28px 20px 24px;
    background: linear-gradient(135deg, var(--red-dark), var(--red), #ef4444);
    color: var(--white);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
}

.app-header h1 {
    margin: 4px 0 0;
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .78;
}

.avatar-link,
.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,.34);
    font-weight: 800;
}

.app-content {
    padding: 18px 16px 96px;
}

.balance-card {
    margin-top: -48px;
    padding: 20px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(99, 20, 20, .16);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.balance-card p,
.detail-head p {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.balance-card strong {
    font-size: 34px;
    letter-spacing: 0;
}

.balance-card > .material-symbols-rounded,
.balance-action {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: #fee2e2;
    color: var(--red);
    display: grid;
    place-items: center;
    font-size: 32px;
}

.balance-action {
    border: 0;
    cursor: pointer;
}

.balance-action .material-symbols-rounded {
    font-size: 32px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 20px;
}

.metric-grid article,
.detail-card,
.profile-card,
.filter-card,
.profile-form-card,
.auth-card {
    background: #fff;
    border: 1px solid rgba(229, 231, 235, .9);
    border-radius: 18px;
}

.metric-grid article {
    padding: 14px;
}

.metric-grid span,
.info-row span,
.order-row span,
.item-row span,
.point-row span,
.product-info span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.metric-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 15px;
}

.section-title {
    margin: 22px 2px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: 0;
}

.section-title a {
    color: var(--red);
    font-size: 13px;
    font-weight: 800;
}

.horizontal-products {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 76%;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.horizontal-products::-webkit-scrollbar { display: none; }

.product-list,
.list-stack {
    display: grid;
    gap: 12px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 118px 1fr;
    min-height: 138px;
}

.product-card.compact {
    grid-template-columns: 104px 1fr;
}

.product-card img {
    width: 100%;
    height: 100%;
    min-height: 138px;
    object-fit: cover;
    background: #f3f4f6;
}

.product-card h2,
.product-card h3 {
    margin: 4px 0 6px;
    font-size: 16px;
    line-height: 1.25;
    letter-spacing: 0;
}

.product-card h3 { font-size: 15px; }

.product-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card > div,
.product-info {
    padding: 13px;
}

.product-meta {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-meta strong,
.product-card strong {
    color: var(--red-dark);
    font-size: 15px;
}

.product-meta em {
    padding: 5px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

.order-row,
.item-row,
.point-row,
.info-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-row.tall { align-items: flex-start; }
.right { text-align: right; }

.order-row strong,
.item-row strong,
.point-row strong,
.info-row strong {
    font-size: 14px;
}

.order-row em,
.status-pill {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

.status-pill.approved,
.status-pill.closed { background: #dcfce7; color: var(--green); }
.status-pill.rejected,
.status-pill.cancelled { background: #fee2e2; color: #b91c1c; }
.status-pill.draft { background: #f3f4f6; color: #374151; }

.detail-card {
    padding: 16px;
}

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.detail-head h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.detail-grid div {
    background: #f9fafb;
    border-radius: 14px;
    padding: 12px;
}

.detail-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 14px;
}

.point-row em {
    display: block;
    margin-top: 4px;
    color: #9ca3af;
    font-size: 11px;
    font-style: normal;
}

.plus { color: var(--green); }
.minus { color: #b91c1c; }

.search-panel {
    margin-top: -42px;
    margin-bottom: 16px;
    height: 54px;
    padding: 0 14px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 28px rgba(99, 20, 20, .12);
}

.search-panel input {
    border: 0;
    outline: 0;
    width: 100%;
    font: inherit;
}

.profile-card {
    margin-top: -40px;
    padding: 24px 16px;
    text-align: center;
}

.filter-card {
    margin-top: -42px;
    padding: 14px;
    box-shadow: 0 12px 28px rgba(99, 20, 20, .12);
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 130px;
    align-items: center;
    gap: 12px;
}

.filter-row label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.filter-row select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.compact-total {
    margin-top: 14px;
    margin-bottom: 16px;
}

.compact-total strong {
    font-size: 28px;
}

.compact-total div > span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.profile-form-card {
    margin-top: 14px;
    padding: 16px;
}

.section-title.in-card {
    margin: 0 0 12px;
}

.profile-avatar {
    margin: 0 auto 12px;
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--red-dark), var(--red));
    font-size: 26px;
}

.profile-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.profile-card p,
.profile-card span {
    display: block;
    margin: 4px 0;
    color: var(--muted);
}

.logout-btn,
.primary-btn,
.ghost-btn {
    min-height: 48px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.logout-btn {
    margin-top: 16px;
    background: #111827;
    color: #fff;
}

.empty-state {
    padding: 22px;
    border: 1px dashed #d1d5db;
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
    background: #fff;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100%, 480px);
    height: 76px;
    padding: 8px 16px 12px;
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    backdrop-filter: blur(12px);
}

.bottom-nav a {
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-weight: 800;
}

.bottom-nav a.active {
    color: var(--red);
}

.bottom-nav .material-symbols-rounded {
    font-size: 24px;
}

.bottom-nav small {
    font-size: 11px;
}

.qr-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(17, 24, 39, .55);
    display: grid;
    place-items: end center;
    padding: 16px;
}

.qr-backdrop[hidden] { display: none; }

.qr-sheet {
    width: min(100%, 430px);
    background: #fff;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .32);
}

.qr-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.qr-sheet-head h2 {
    margin: 4px 0 0;
    font-size: 22px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: #f3f4f6;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.qr-body {
    padding: 18px 0 12px;
    text-align: center;
}

.qr-image {
    width: 280px;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.qr-code-text {
    margin-top: 12px;
    font-weight: 900;
    color: var(--red-dark);
}

.qr-meta {
    width: 190px;
    margin: 14px auto 8px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #fef2f2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qr-meta span,
.qr-note {
    color: var(--muted);
    font-size: 12px;
}

.qr-expire {
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

.qr-note {
    margin: 8px auto 0;
    line-height: 1.5;
}

.qr-loading {
    padding: 40px 0;
    color: var(--muted);
    font-weight: 800;
}

.qr-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.qr-actions .primary-btn,
.qr-actions .ghost-btn {
    gap: 7px;
}

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 10%, rgba(255,255,255,.2), transparent 26%),
        linear-gradient(155deg, #7f1d1d 0%, #b91c1c 48%, #ffffff 48%, #f8fafc 100%);
}

.auth-shell {
    width: min(100%, 420px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 54px 18px 34px;
}

.auth-hero {
    color: #fff;
    padding: 8px 4px 24px;
    display: grid;
    justify-items: center;
    text-align: center;
}

.logo-mark {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: #fff;
    color: #b91c1c;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0;
    margin-bottom: 16px;
    box-shadow: 0 18px 42px rgba(69, 10, 10, .26);
}

.auth-hero h1 {
    margin: 0;
    font-size: 27px;
    line-height: 1.15;
    letter-spacing: 0;
    font-weight: 900;
}

.muted {
    color: rgba(255,255,255,.82);
    line-height: 1.55;
}

.auth-card {
    padding: 22px;
    display: grid;
    gap: 16px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(69, 10, 10, .18);
}

.form-stack {
    display: grid;
    gap: 10px;
}

.form-stack label {
    font-size: 13px;
    font-weight: 800;
    color: #3f1010;
}

.form-stack input {
    width: 100%;
    min-height: 50px;
    border: 1px solid #f0d1d1;
    border-radius: 16px;
    padding: 0 15px;
    font: inherit;
    background: #fffafa;
    color: var(--ink);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.form-stack input:focus {
    background: #fff;
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .12);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 52px;
}

.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 14px;
    background: #fff1f2;
    color: #b91c1c;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.toggle-password .material-symbols-rounded {
    font-size: 21px;
}

.primary-btn {
    border: 0;
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
    color: #fff;
    cursor: pointer;
    font: inherit;
    box-shadow: 0 14px 28px rgba(185, 28, 28, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(185, 28, 28, .34);
}

.ghost-btn {
    border: 1px solid var(--line);
    color: var(--red);
}

.auth-divider {
    position: relative;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--line);
}

.auth-divider span {
    position: relative;
    z-index: 1;
    padding: 0 10px;
    background: #fff;
}

.auth-switch {
    margin: 0;
    text-align: center;
    color: #7f1d1d;
    font-size: 14px;
    font-weight: 700;
}

.auth-switch a {
    color: #dc2626;
    font-weight: 900;
}

.alert {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
}

.alert.success { background: #dcfce7; color: #166534; }
.alert.warning { background: #fef3c7; color: #92400e; }
.alert.error { background: #fee2e2; color: #991b1b; }

@media (max-width: 360px) {
    .app-header h1 { font-size: 23px; }
    .balance-card strong { font-size: 28px; }
    .product-card { grid-template-columns: 100px 1fr; }
}
