:root {
  --brand: #003057;
  --brand-2: #0f6b8a;
  --accent: #1685b6;
  --bg: #eef3f6;
  --surface: #ffffff;
  --text: #17232d;
  --muted: #61717e;
  --border: #d6e0e6;
  --danger: #a62b2b;
  --danger-bg: #fdecec;
  --ok: #20734f;
  --ok-bg: #e9f6f0;
  --warning: #9a5a12;
  --warning-bg: #fff3df;
  --shadow: 0 8px 24px rgba(0, 48, 87, .09);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
button, input { font: inherit; }
button { touch-action: manipulation; }
.app-header { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: calc(18px + env(safe-area-inset-top)) 18px 18px; }
.header-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 4px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .76; }
h1 { margin: 0; font-size: clamp(1.65rem, 6vw, 2.3rem); }
.subtitle { margin: 5px 0 0; opacity: .88; }
.status-badge { white-space: nowrap; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); font-size: .82rem; font-weight: 700; }
.status-badge.offline { background: #7b321f; }
.container { width: min(980px, calc(100% - 24px)); margin: 18px auto 30px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 { color: var(--brand); margin: 0 0 8px; font-size: 1.2rem; }
.card-head, .detail-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.muted { color: var(--muted); margin: 0; }
.button { border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 750; cursor: pointer; }
.button.primary { color: #fff; background: var(--brand); }
.button.secondary { color: var(--brand); background: #e9f1f5; }
.button:disabled { opacity: .55; cursor: default; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.meta-grid div { background: #f4f7f9; padding: 11px; border-radius: 12px; min-width: 0; }
.meta-grid span { display: block; color: var(--muted); font-size: .75rem; margin-bottom: 3px; }
.meta-grid strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.message { margin-top: 14px; padding: 11px 13px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 650; }
.message.error { background: var(--danger-bg); color: var(--danger); }
.search-input { width: 100%; border: 2px solid var(--border); border-radius: 13px; padding: 14px 15px; font-size: 1.03rem; color: var(--text); outline: 0; background: #fff; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(22,133,182,.12); }
.search-input:disabled { background: #f2f4f5; }
.search-info { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 9px 2px 0; }
.text-button { padding: 2px; border: 0; background: transparent; color: var(--brand-2); font-weight: 700; cursor: pointer; }
.results { margin-top: 12px; display: grid; gap: 10px; }
.result-item { width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; background: #fff; cursor: pointer; color: var(--text); }
.result-item:active { transform: scale(.995); }
.result-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.result-name { font-weight: 800; color: var(--brand); font-size: 1.02rem; }
.result-kuid { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.result-sub { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.empty-state { text-align: center; padding: 22px 10px; color: var(--muted); }
.detail-title-wrap { min-width: 0; flex: 1; }
.detail-title-wrap h2 { margin-bottom: 3px; }
.customer-number { margin: 0 0 3px; color: var(--brand-2); font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 17px 0; }
.action-link { text-decoration: none; color: var(--brand); background: #eef5f8; border: 1px solid #d5e6ed; border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; text-align: center; font-size: .78rem; font-weight: 750; min-height: 64px; }
.action-link.disabled { opacity: .45; pointer-events: none; }
.action-icon { font-size: 1.25rem; }
.tabs { display: flex; overflow-x: auto; gap: 7px; margin: 4px -2px 15px; padding: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--brand); background: #fff; font-weight: 750; cursor: pointer; }
.tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.tab-panel { animation: fade .16s ease; }
@keyframes fade { from { opacity: .45; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.section-title { color: var(--brand-2); margin: 16px 0 8px; font-size: .95rem; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.data-field { border: 1px solid var(--border); border-radius: 12px; padding: 10px 11px; min-width: 0; }
.data-field.wide { grid-column: 1 / -1; }
.data-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .035em; margin-bottom: 3px; }
.data-value { overflow-wrap: anywhere; font-weight: 650; }
.data-value a { color: var(--brand-2); }
.revenue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.revenue-card { border-radius: 13px; padding: 12px; background: #f2f6f8; border: 1px solid var(--border); }
.revenue-card.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.revenue-label { font-size: .75rem; opacity: .76; }
.revenue-value { margin-top: 4px; font-size: 1.12rem; font-weight: 850; overflow-wrap: anywhere; }
.change-pill { display: inline-block; margin-top: 8px; border-radius: 999px; padding: 4px 7px; font-size: .76rem; font-weight: 800; }
.change-pill.up { color: var(--ok); background: var(--ok-bg); }
.change-pill.down { color: var(--danger); background: var(--danger-bg); }
.change-pill.neutral { color: var(--muted); background: #edf0f2; }
.warning-box { margin: 0 0 12px; padding: 11px 12px; border-radius: 11px; color: var(--danger); background: var(--danger-bg); font-weight: 750; }
.privacy-note { border-left: 4px solid var(--brand-2); padding: 12px 14px; background: #e8f2f6; color: #284552; border-radius: 0 10px 10px 0; font-size: .86rem; line-height: 1.4; }
.app-footer { text-align: center; color: var(--muted); padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 640px) {
  .container { width: min(100% - 16px, 980px); margin-top: 10px; }
  .card { padding: 14px; border-radius: 15px; }
  .card-head { align-items: stretch; flex-direction: column; }
  .card-head .button { width: 100%; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid div:last-child { grid-column: 1 / -1; }
  .detail-head { align-items: flex-start; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .data-grid, .revenue-grid { grid-template-columns: 1fr; }
}
