:root {
    --blue: #00539b;
    --blue-dark: #003e78;
    --blue-soft: #e9f3fb;
    --red: #ef233c;
    --yellow: #ffc928;
    --green: #16834a;
    --ink: #17324d;
    --muted: #687b8d;
    --line: #dbe5ee;
    --background: #f5f8fc;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.app-header { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1180px; height: 74px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 112px; }
.brand span { color: var(--blue-dark); font-weight: 850; font-size: 14px; }
.desktop-nav { display: flex; align-items: center; gap: 5px; }
.desktop-nav a { padding: 9px 11px; border-radius: 6px; color: #4d6275; font-weight: 700; font-size: 13px; }
.desktop-nav a:hover, .desktop-nav a.active { background: var(--blue-soft); color: var(--blue-dark); }
.account-menu { display: flex; align-items: center; gap: 10px; }
.account-menu div { text-align: right; }
.account-menu strong, .account-menu small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu small { color: var(--muted); }
.brand-rule { height: 4px; display: grid; grid-template-columns: 2fr 1fr 1fr; }
.brand-rule i:nth-child(1) { background: var(--blue); }
.brand-rule i:nth-child(2) { background: var(--yellow); }
.brand-rule i:nth-child(3) { background: var(--red); }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 52px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-heading h1 { margin: 0; color: var(--blue-dark); font-size: 25px; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }

.welcome-band { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 20px; margin-bottom: 20px; padding: 26px; color: #fff; background: var(--blue-dark); border-radius: 8px; overflow: hidden; border-bottom: 5px solid var(--yellow); }
.welcome-band h1 { margin: 0 0 8px; font-size: 28px; }
.welcome-band p { margin: 0; max-width: 680px; color: #d8eaf8; }
.welcome-summary { align-self: center; padding-left: 22px; border-left: 1px solid rgba(255,255,255,.25); }
.welcome-summary span { color: #b9d6ed; font-size: 12px; }
.welcome-summary strong { display: block; color: var(--yellow); font-size: 25px; margin-top: 4px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card, .card { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.summary-card { padding: 18px; }
.summary-card span { color: var(--muted); font-size: 12px; font-weight: 750; }
.summary-card strong { display: block; margin-top: 6px; color: var(--blue-dark); font-size: 22px; }
.summary-card small { color: var(--muted); display: block; margin-top: 6px; }
.summary-card.red { border-top: 3px solid var(--red); }
.summary-card.yellow { border-top: 3px solid var(--yellow); }
.summary-card.green { border-top: 3px solid var(--green); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 20px; }
.card { margin-bottom: 18px; }
.card-header { min-height: 57px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-header h2 { margin: 0; color: var(--blue-dark); font-size: 16px; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 17px; }

.invoice-list { display: grid; gap: 12px; }
.invoice { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.invoice h3 { margin: 0; font-size: 15px; }
.invoice p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.invoice-value { text-align: right; }
.invoice-value strong { display: block; color: var(--blue-dark); font-size: 18px; }
.invoice-value span { color: var(--muted); font-size: 11px; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; font-weight: 800; white-space: nowrap; }
.button.primary { background: var(--blue); color: #fff; }
.button.red { background: var(--red); color: #fff; }
.button.yellow { background: var(--yellow); color: #423300; }
.button.green { background: var(--green); color: #fff; }
.button.outline { border-color: var(--line); color: var(--blue-dark); }
.button.full { width: 100%; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.button:disabled { opacity: .55; cursor: wait; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.badge.success { color: #0c6a3c; background: #dcf5e7; }
.badge.danger { color: #a91d2e; background: #ffe3e7; }
.badge.warning { color: #82540c; background: #fff0bd; }
.badge.info { color: #07558f; background: #dceefb; }
.badge.neutral { color: #526476; background: #edf1f5; }

.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 650; }
.alert.success { color: #0c6639; background: #ddf5e7; border: 1px solid #bce8cf; }
.alert.danger { color: #9f1c2c; background: #ffe7ea; border: 1px solid #ffc8cf; }
.alert.warning { color: #765009; background: #fff3ca; border: 1px solid #ffe18d; }
.alert.info { color: #07558f; background: #e0f0fb; border: 1px solid #bedff5; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label { color: #536678; font-size: 12px; font-weight: 750; }
label input, label select, label textarea { width: 100%; min-height: 43px; margin-top: 5px; padding: 9px 10px; color: var(--ink); background: #fff; border: 1px solid #ccd8e3; border-radius: 6px; outline: 0; }
label textarea { min-height: 90px; resize: vertical; }
label input:focus, label select:focus, label textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,83,155,.1); }
.check { display: flex; align-items: flex-start; gap: 9px; }
.check input { width: 18px; min-height: 18px; margin-top: 1px; }

.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid #edf1f5; }
.simple-list li:last-child { border: 0; }
.simple-list strong, .simple-list span { display: block; }
.simple-list span { color: var(--muted); font-size: 12px; margin-top: 2px; }

.products { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.product { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.product-image { aspect-ratio: 1/1; width: 100%; object-fit: cover; background: #fff; border-bottom: 1px solid var(--line); }
.product-body { display: flex; flex: 1; flex-direction: column; padding: 14px; }
.product-body h2 { margin: 0; color: var(--blue-dark); font-size: 16px; }
.product-body p { flex: 1; margin: 6px 0 12px; color: var(--muted); font-size: 12px; }
.product-price { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.product-price strong { color: var(--blue-dark); font-size: 18px; }
.cart-bar { position: sticky; bottom: 12px; z-index: 15; display: none; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 13px 15px; background: var(--blue-dark); color: #fff; border-radius: 8px; box-shadow: 0 14px 38px rgba(0,46,88,.24); }
.cart-bar.visible { display: flex; }
.cart-bar strong, .cart-bar span { display: block; }
.cart-bar span { color: #c9e0f2; font-size: 12px; }

.authorized-row { display: grid; grid-template-columns: 1.4fr 1fr .8fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--blue-dark); margin-bottom: 4px; }

.bottom-nav { display: none; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(330px,1.2fr) minmax(380px,520px); background: #eef4f9; }
.auth-visual { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px,7vw,100px); color: #fff; background: var(--blue-dark); border-bottom: 6px solid var(--yellow); }
.auth-visual img { width: 190px; padding: 12px; background: #fff; border-radius: 8px; }
.auth-visual h1 { max-width: 620px; margin: 28px 0 8px; font-size: 38px; line-height: 1.1; }
.auth-visual p { max-width: 560px; margin: 0; color: #d3e6f6; font-size: 16px; }
.auth-panel { align-self: center; width: min(420px,calc(100% - 40px)); margin: 30px auto; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 60px rgba(8,53,92,.12); }
.auth-panel h2 { margin: 0; color: var(--blue-dark); }
.auth-panel > p { margin: 5px 0 22px; color: var(--muted); }
.auth-panel form { display: grid; gap: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; color: var(--blue); font-size: 12px; font-weight: 750; }

@media (max-width: 960px) {
    .desktop-nav { display: none; }
    .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .products { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 720px) {
    body { padding-bottom: 72px; }
    .header-inner { height: 64px; padding: 0 14px; }
    .brand img { width: 92px; }
    .brand span, .account-menu .button, .account-menu small { display: none; }
    .account-menu strong { max-width: 110px; font-size: 12px; }
    .page { width: min(100% - 28px,1180px); padding: 20px 0 32px; }
    .welcome-band { grid-template-columns: 1fr; padding: 20px; }
    .welcome-band h1 { font-size: 23px; }
    .welcome-summary { padding: 15px 0 0; border: 0; border-top: 1px solid rgba(255,255,255,.22); }
    .page-heading { align-items: flex-start; }
    .page-heading h1 { font-size: 22px; }
    .invoice { grid-template-columns: 1fr auto; }
    .invoice .button { grid-column: 1 / -1; width: 100%; }
    .bottom-nav { position: fixed; inset: auto 0 0; z-index: 40; height: 66px; display: grid; grid-template-columns: repeat(5,1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #65788a; font-size: 10px; font-weight: 750; }
    .bottom-nav a b { font-size: 12px; }
    .bottom-nav a.active { color: var(--blue); background: var(--blue-soft); }
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { min-height: 250px; padding: 30px 24px; }
    .auth-visual img { width: 140px; }
    .auth-visual h1 { margin-top: 20px; font-size: 27px; }
}

@media (max-width: 520px) {
    .summary-grid, .form-grid, .products { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
    .products { gap: 12px; }
    .product { display: grid; grid-template-columns: 120px 1fr; }
    .product-image { height: 100%; aspect-ratio: auto; border: 0; border-right: 1px solid var(--line); }
    .product-body { min-width: 0; }
    .product-price { align-items: flex-start; flex-direction: column; }
    .authorized-row { grid-template-columns: 1fr; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
    .button.mobile-full { width: 100%; }
}

