:root {
    --ink: #15212d;
    --muted: #687585;
    --line: #dfe6ec;
    --surface: #ffffff;
    --canvas: #f4f7f9;
    --cyan: #00bde7;
    --cyan-dark: #008dbd;
    --magenta: #d800d8;
    --navy: #101c2a;
    --danger: #c73745;
    --success: #087c5b;
    --shadow: 0 18px 55px rgba(17, 28, 42, .12);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, "Segoe UI", Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: .55rem; font-size: 1.35rem; letter-spacing: -.02em; }

.auth-page { min-height: 100vh; background: radial-gradient(circle at 20% 12%, rgba(0, 189, 231, .22), transparent 31%), radial-gradient(circle at 83% 82%, rgba(216, 0, 216, .18), transparent 35%), #0c1724; }
.auth-shell { width: min(1140px, calc(100% - 40px)); min-height: 100vh; margin: auto; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 7vw; padding: 44px 0; }
.auth-brand { color: #fff; display: grid; gap: 70px; }
.auth-brand h1 { max-width: 680px; font-size: clamp(2.5rem, 5vw, 4.8rem); }
.auth-brand p:not(.eyebrow) { max-width: 580px; color: #b9c7d6; font-size: 1.1rem; }
.auth-logo { width: min(480px, 78%); height: auto; filter: drop-shadow(0 15px 24px rgba(0,0,0,.22)); }
.auth-card { width: 100%; max-width: 460px; justify-self: end; background: rgba(255,255,255,.98); border-radius: 26px; padding: clamp(28px, 4vw, 46px); box-shadow: 0 28px 90px rgba(0,0,0,.32); }
.auth-card-logo { display: none; width: 230px; height: 58px; margin: 0 0 24px; object-fit: contain; object-position: left center; }
.auth-card .text-link, .link-button { display: inline-block; margin-top: 20px; color: var(--cyan-dark); text-decoration: none; }
.link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }

.eyebrow { margin-bottom: .6rem; color: var(--cyan-dark); font-weight: 800; font-size: .75rem; letter-spacing: .13em; text-transform: uppercase; }
.auth-brand .eyebrow { color: #55d8f5; }
.muted { color: var(--muted); }
.stack-form { display: grid; gap: 17px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #344352; font-size: .88rem; font-weight: 700; }
input, select { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid #cfd9e1; border-radius: 10px; background: #fff; color: var(--ink); outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus { border-color: var(--cyan-dark); box-shadow: 0 0 0 4px rgba(0, 189, 231, .12); }
input:disabled { color: #677586; background: #edf1f4; }

.btn { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 10px 17px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(115deg, var(--cyan-dark), var(--cyan)); box-shadow: 0 8px 18px rgba(0, 141, 189, .22); }
.btn-secondary { color: #fff; background: var(--navy); }
.btn-ghost { color: var(--ink); background: #edf2f5; }
.btn-block { width: 100%; }

.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 11px; font-size: .92rem; font-weight: 650; }
.alert-success { color: #075e47; background: #e5f7f0; border: 1px solid #bde8d7; }
.alert-error { color: #9c2330; background: #fff0f1; border: 1px solid #f3c6cb; }
.alert-warning { color: #805b12; background: #fff7dd; border: 1px solid #eedc9d; }

.app-header { height: 74px; position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 210px 1fr auto; align-items: center; gap: 28px; padding: 0 4vw; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand img { display: block; width: 176px; height: 44px; object-fit: contain; object-position: left center; }
.main-nav { display: flex; align-items: stretch; height: 100%; gap: 3px; }
.main-nav a, .logout-form button { display: flex; align-items: center; height: 100%; padding: 0 15px; border: 0; border-bottom: 3px solid transparent; color: #596878; background: transparent; font-size: .9rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.main-nav a:hover, .main-nav a.active, .logout-form button:hover { color: var(--cyan-dark); border-bottom-color: var(--cyan); }
.logout-form { height: 100%; margin: 0; }
.user-chip { display: grid; text-align: right; font-size: .88rem; font-weight: 750; }
.user-chip small { margin-top: 2px; color: var(--muted); font-weight: 500; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 1.5rem; }

.content { width: min(1460px, calc(100% - 7vw)); margin: 0 auto; padding: 44px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 26px; }
.page-heading > div:first-child > p:last-child { margin-bottom: 0; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid #e1e7ec; border-radius: var(--radius); padding: clamp(20px, 3vw, 32px); box-shadow: 0 9px 30px rgba(24, 40, 56, .055); }
.heading-actions, .rate-cards { display: flex; gap: 11px; flex-wrap: wrap; justify-content: flex-end; }
.rate-cards > div { min-width: 170px; padding: 15px 18px; background: var(--navy); color: #fff; border-radius: 14px; box-shadow: var(--shadow); }
.rate-cards span { display: block; margin-bottom: 5px; color: #aebdcb; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.rate-cards strong { font-size: 1.35rem; }

.query-panel { min-height: 380px; }
.search-form { max-width: 850px; display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 0 auto 28px; }
.search-form input { min-height: 52px; font-size: 1rem; }
.query-status { color: var(--muted); text-align: center; padding: 35px 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.product-result { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.result-head { padding: 20px; background: linear-gradient(135deg, #101c2a, #1d344a); color: #fff; }
.result-head .tag { background: rgba(255,255,255,.13); color: #dceaf3; }
.result-head h3 { margin: 12px 0 6px; font-size: 1.13rem; }
.result-head p { margin: 0; color: #b9c7d2; font-size: .86rem; }
.result-data { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.result-data > div { padding: 15px 18px; background: #fff; }
.result-data span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .06em; }
.result-data strong { font-size: 1rem; }
.result-data .highlight { background: #e8f9fc; }
.result-data .highlight strong { color: #007fa7; font-size: 1.2rem; }

.table-toolbar { display: grid; grid-template-columns: minmax(260px, 650px) auto; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.table-toolbar span { color: var(--muted); font-size: .88rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: .86rem; }
th { position: sticky; top: 0; z-index: 1; padding: 13px 14px; color: #fff; background: var(--navy); text-align: left; font-size: .75rem; letter-spacing: .035em; text-transform: uppercase; }
td { padding: 13px 14px; border-bottom: 1px solid #e7ecef; vertical-align: middle; }
tbody tr:hover { background: #f6fbfd; }
tbody tr:last-child td { border-bottom: 0; }
.number { text-align: right; white-space: nowrap; }
.tag { display: inline-block; padding: 5px 8px; border-radius: 999px; color: #365267; background: #edf3f6; font-size: .74rem; font-weight: 700; }
.actions-cell { display: flex; gap: 7px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.icon-button { padding: 5px 7px; border: 0; background: transparent; color: var(--cyan-dark); font-size: .8rem; font-weight: 750; cursor: pointer; }
.icon-button.danger { color: var(--danger); }

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.profile-grid .panel h2 { padding-bottom: 14px; border-bottom: 1px solid var(--line); }

.modal { width: min(520px, calc(100% - 30px)); border: 0; border-radius: 20px; padding: 0; color: var(--ink); box-shadow: 0 30px 90px rgba(10, 20, 30, .35); }
.modal::backdrop { background: rgba(8, 18, 28, .68); backdrop-filter: blur(3px); }
.modal > form { display: grid; gap: 17px; padding: 28px; }
.modal-wide { width: min(780px, calc(100% - 30px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: transparent; color: #687585; font-size: 1.8rem; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 17px; }
.span-2 { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; gap: 34px; }
    .auth-brand { gap: 25px; }
    .auth-brand h1 { font-size: 2.4rem; }
    .auth-card { justify-self: center; }
    .app-header { grid-template-columns: 1fr auto; padding: 0 20px; }
    .menu-toggle { display: block; }
    .main-nav { display: none; position: absolute; top: 73px; left: 0; right: 0; height: auto; flex-direction: column; padding: 12px 20px 18px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 16px 25px rgba(20,35,50,.09); }
    .main-nav.open { display: flex; }
    .main-nav a, .logout-form button { width: 100%; min-height: 44px; border-bottom: 0; border-left: 3px solid transparent; }
    .logout-form { height: auto; }
    .main-nav a.active { border-left-color: var(--cyan); }
    .user-chip { display: none; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions, .rate-cards { justify-content: flex-start; }
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .auth-shell { width: min(100% - 24px, 520px); padding: 24px 0; }
    .auth-brand { display: none; }
    .auth-card-logo { display: block; }
    .auth-card { padding: 27px 22px; }
    .content { width: calc(100% - 28px); padding-top: 28px; }
    .page-heading { margin-bottom: 20px; }
    .rate-cards { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
    .rate-cards > div { min-width: 0; }
    .heading-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
    .search-form { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: 1fr; }
    .result-data { grid-template-columns: 1fr; }
    .table-toolbar { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
}
