:root {
  color-scheme: light;
  --ink: #12372e;
  --ink-soft: #2e4b42;
  --paper: #fff;
  --surface: #f1f6f3;
  --line: #d0ddd6;
  --muted: #61756c;
  --blue: #2f91bb;
  --blue-dark: #217296;
  --teal: #167a5a;
  --coral: #d65d4b;
  --amber: #c58a26;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--ink); font-size: 15px; line-height: 1.5; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 100; top: -60px; left: 12px; background: #fff; padding: 10px; }
.skip-link:focus { top: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-size: 20px; font-weight: 850; text-decoration: none; }
.brand img { border-radius: 8px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 11px; font-weight: 900; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.1; }
h2 { margin: 0; font-size: 21px; }
h3 { margin: 0; font-size: 17px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 800; white-space: nowrap; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: #0f6247; }
.button-quiet { border-color: var(--line); background: #fff; color: var(--ink); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.auth-view { min-height: 100vh; background: var(--ink); color: #fff; }
.auth-header { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(22px, calc((100% - 1160px) / 2)); border-bottom: 4px solid var(--blue); }
.auth-header .brand { color: #fff; }
.language-control { display: flex; align-items: center; gap: 9px; color: #9eacb8; font-size: 12px; font-weight: 800; }
.language-select { height: 36px; border: 1px solid #b9c4cd; border-radius: 6px; background: #fff; color: var(--ink); padding: 0 8px; font-size: 12px; font-weight: 800; }
.auth-main { width: min(1160px, calc(100% - 40px)); min-height: calc(100vh - 72px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr); align-items: stretch; }
.auth-intro { display: flex; flex-direction: column; justify-content: center; padding: 70px 9vw 70px 0; }
.auth-intro h1 { max-width: 640px; }
.auth-intro > p:not(.eyebrow) { max-width: 620px; color: #b9c5cf; font-size: 18px; }
.auth-intro > a { margin-top: 24px; color: #72c9e8; font-weight: 800; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 54px clamp(24px, 5vw, 64px); background: #fff; color: var(--ink); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.auth-tabs[data-registration="disabled"] { grid-template-columns: 1fr; }
.auth-tabs button { min-height: 46px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 850; }
.auth-tabs button.is-active { border-color: var(--teal); color: var(--ink); }
.auth-form { display: grid; gap: 17px; }
.form-heading { margin-bottom: 8px; }
.form-heading p { margin: 6px 0 0; color: var(--muted); }
.auth-form label, .ticket-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 850; }
input, select, textarea { width: 100%; border: 1px solid #bbc6cf; border-radius: 6px; background: #fff; color: var(--ink); padding: 10px 11px; }
input, select { height: 42px; }
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(22, 122, 90, .2); border-color: var(--teal); }
.check-field { display: grid !important; grid-template-columns: 20px 1fr; align-items: start; }
.check-field input { width: 18px; height: 18px; }
.legal-links { margin: -8px 0 2px; display: flex; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.legal-links a { color: var(--teal); }
.form-status { min-height: 20px; margin: 3px 0 0; color: var(--teal); font-size: 12px; }
.form-status[data-error="true"] { color: var(--coral); }
.portal-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ink); color: #fff; }
.sidebar-brand { height: 70px; padding: 0 20px; border-bottom: 4px solid var(--coral); color: #fff; }
.portal-nav { display: grid; gap: 4px; padding: 18px 10px; }
.portal-nav button { min-height: 44px; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #b5c0c9; text-align: left; font-size: 13px; font-weight: 750; }
.portal-nav button:hover { background: #1c4a3d; color: #fff; }
.portal-nav button.is-active { background: var(--teal); color: #fff; }
.nav-mark { color: #72c9e8; font-size: 9px; font-weight: 900; }
.portal-nav button.is-active .nav-mark { color: #fff; }
.portal-nav em { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: #fff; font-size: 10px; font-style: normal; }
.sidebar-footer { margin-top: auto; display: grid; padding: 15px 20px 22px; border-top: 1px solid #356052; }
.sidebar-footer a { padding: 6px 0; color: #8e9ca8; font-size: 12px; text-decoration: none; }
.portal-main { min-width: 0; }
.portal-header { position: sticky; z-index: 20; top: 0; height: 70px; display: flex; align-items: center; gap: 14px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); }
.portal-header > div:nth-child(2) { display: flex; flex-direction: column; }
.portal-header span { color: var(--muted); font-size: 11px; font-weight: 800; }
.portal-header strong { font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.sidebar-toggle { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.workspace { width: min(1280px, 100%); margin: 0 auto; padding: 34px; }
.portal-page { min-height: calc(100vh - 138px); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.stat-card { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 8px; background: #fff; }
.stat-card[data-tone="teal"] { border-top-color: var(--teal); }
.stat-card[data-tone="coral"] { border-top-color: var(--coral); }
.stat-card[data-tone="amber"] { border-top-color: var(--amber); }
.stat-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.stat-card strong { display: block; margin-top: 13px; font-size: 29px; line-height: 1; }
.stat-card small { display: block; margin-top: 8px; color: var(--muted); }
.overview-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.data-section { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.section-heading button { border: 0; background: transparent; color: var(--teal); font-weight: 800; }
.plan-summary { padding-top: 20px; }
.plan-summary strong { font-size: 25px; }
.plan-summary p { color: var(--muted); }
.capacity-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.capacity-row div { padding: 13px; background: var(--surface); border-radius: 6px; }
.capacity-row span { display: block; color: var(--muted); font-size: 11px; }
.capacity-row b { font-size: 18px; }
.compact-record { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.compact-record:last-child { border-bottom: 0; }
.compact-record small { display: block; color: var(--muted); }
.status-badge { align-self: center; padding: 4px 8px; border-radius: 5px; background: #e9f7f4; color: #087665; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-badge[data-status="failed"], .status-badge[data-status="cancelled"] { background: #fcebe8; color: #ac3828; }
.status-badge[data-status="pending_payment"], .status-badge[data-status="payment_configuration_required"], .status-badge[data-status="contact_required"] { background: #fff4d9; color: #8a5c08; }
.billing-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.billing-control button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 850; }
.billing-control button.is-active { background: var(--ink); color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.product-card { min-height: 410px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 8px; background: #fff; }
.product-card[data-featured="true"] { border-top-color: var(--teal); box-shadow: 0 12px 28px rgba(17, 24, 32, .08); }
.product-card h2 { margin-top: 10px; }
.product-card > p { min-height: 70px; color: var(--muted); font-size: 13px; }
.product-price { margin: 12px 0 18px; font-size: 28px; font-weight: 850; }
.product-price small { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.product-features { padding: 15px 0 0; margin: 0 0 20px; border-top: 1px solid var(--line); list-style: none; }
.product-features li { padding: 5px 0; color: var(--ink-soft); font-size: 12px; }
.product-card .button { width: 100%; margin-top: auto; }
.subheading { margin: 44px 0 16px; }
.subheading p { margin: 5px 0 0; color: var(--muted); }
.addon-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.addon-card { min-height: 178px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.addon-card p { color: var(--muted); font-size: 12px; }
.addon-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.addon-card button { min-height: 34px; }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.cart-lines { display: grid; gap: 10px; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.cart-line p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.quantity-control { display: flex; align-items: center; gap: 7px; }
.quantity-control button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.remove-button { border: 0; background: transparent; color: var(--coral); font-weight: 800; }
.order-summary { position: sticky; top: 88px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink); color: #fff; }
.order-summary dl { margin: 20px 0; }
.order-summary dl div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; color: #aab7c2; }
.order-summary dl .total { margin-top: 8px; padding-top: 15px; border-top: 1px solid #44515d; color: #fff; font-size: 17px; font-weight: 850; }
.order-summary .button { width: 100%; }
.order-summary > p:not(.form-status) { color: #8d9ba7; font-size: 11px; }
.record-list, .ticket-list { display: grid; gap: 9px; }
.record-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; min-height: 82px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.record-row small { display: block; color: var(--muted); }
.record-row .amount { font-weight: 850; }
.empty-state { padding: 40px 20px; border: 1px dashed #b8c3cc; border-radius: 8px; color: var(--muted); text-align: center; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.device-card { min-height: 160px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.device-card .device-id { display: block; margin-top: 16px; color: var(--teal); font-family: Consolas, monospace; }
.device-card p { color: var(--muted); font-size: 12px; }
.ticket-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 16px; }
.ticket-form .field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; }
.ticket-row { cursor: pointer; }
.ticket-row:hover { border-color: #9eb2c3; }
.ticket-dialog { width: min(760px, calc(100% - 30px)); max-height: 86vh; padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3); }
.ticket-dialog::backdrop { background: rgba(11, 17, 23, .66); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog-header span { color: var(--muted); font-size: 11px; }
.dialog-header button { width: 36px; height: 36px; border: 0; border-radius: 6px; background: var(--surface); font-size: 24px; }
.ticket-thread { max-height: 48vh; overflow: auto; padding: 20px 22px; background: var(--surface); }
.ticket-message { max-width: 82%; margin-bottom: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ticket-message[data-author="support"] { margin-left: auto; border-color: #acdcd3; background: #edf9f7; }
.ticket-message header { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; }
.ticket-message p { margin: 8px 0 0; white-space: pre-wrap; }
.ticket-reply { display: grid; gap: 10px; padding: 18px 22px; }
.ticket-reply textarea { min-height: 90px; }
@media (max-width: 1100px) {
  .stat-grid, .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .auth-main { grid-template-columns: 1fr; }
  .auth-intro { min-height: 400px; padding: 70px 0; }
  .auth-panel { min-height: 620px; }
  .portal-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: -240px; width: 228px; transition: left .2s ease; }
  .portal-shell.sidebar-open .sidebar { left: 0; }
  .sidebar-toggle { display: block; }
  .workspace { padding: 24px 18px; }
  .overview-columns, .cart-layout { grid-template-columns: 1fr; }
  .order-summary { position: static; }
}
@media (max-width: 600px) {
  .auth-header { padding: 0 14px; }
  .language-control span { display: none; }
  .auth-main { width: 100%; }
  .auth-intro, .auth-panel { padding-left: 18px; padding-right: 18px; }
  .portal-header { padding: 0 12px; }
  .portal-header > div:nth-child(2) { display: none; }
  .header-actions .button { padding: 0 10px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stat-grid, .product-grid, .addon-grid, .device-grid { grid-template-columns: 1fr; }
  .cart-line, .record-row { grid-template-columns: 1fr; }
  .ticket-form { grid-template-columns: 1fr; }
  .ticket-form .field-wide { grid-column: auto; }
}
