/* FILE: /app/static/style.css */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e5e7ef;
  --text: #111827;
  --muted: #6b7280;
  --btn: #2563eb;
  --btn2: #eef1f5;
  --danger: #ef4444;
  --ok: #16a34a;
  --err: #dc2626;
  --shadow: rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap { max-width: 1200px; margin: 20px auto; padding: 0 16px 48px; }

.topbar {
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 10px 20px var(--shadow);
}

.brand { font-weight: 800; letter-spacing: 0.4px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

.card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
  box-shadow: 0 12px 26px var(--shadow);
}

.ops-card {
  border-color: rgba(37, 99, 235, 0.28);
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 42%),
    linear-gradient(145deg, #ffffff, #f8fbff);
}

.ops-eyebrow {
  margin: 0 0 5px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pos-dashboard-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.pos-dashboard-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.status-pill.attention {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.status-pill.neutral {
  color: #475569;
  background: #f1f5f9;
}

.ops-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.82);
}

.ops-toolbar .row { margin-top: 0; }
.ops-toolbar .btn { min-height: 44px; }

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

.metric-card {
  min-width: 0;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.06);
}

.metric-card strong,
.metric-card span,
.metric-card small {
  display: block;
}

.metric-card strong {
  margin-top: 6px;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-card small,
.metric-label {
  color: #64748b;
  font-size: 11px;
}

.metric-card small { margin-top: 5px; }

.pos-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.compact-table { max-height: 220px; }
.compact-table .table th,
.compact-table .table td {
  padding: 8px;
  font-size: 12px;
}

.quality-list {
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 12px;
}

.quality-list li + li { margin-top: 7px; }
.quality-list .critical { color: #991b1b; }
.quality-list .high { color: #92400e; }

h1 { margin: 0 0 8px; font-size: 22px; }
h2 { margin: 0 0 8px; font-size: 18px; }
h3 { margin: 0 0 6px; font-size: 15px; color: #1f2937; }
h4 { margin: 0 0 6px; font-size: 14px; color: #1f2937; }

.row { margin-top: 8px; }
label { display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

input, textarea, select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

textarea.mono, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.actions { display:flex; gap:8px; margin-top: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid rgba(17,24,39,0.1);
  background: var(--btn);
  color: white;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn.secondary {
  background: var(--btn2);
  color: #111827;
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.tiny { padding: 6px 8px; border-radius: 9px; font-size: 12px; }

.msg {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  display:none;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.msg.ok {
  display:block;
  background: rgba(22,163,74,0.08);
  border: 1px solid rgba(22,163,74,0.3);
  color: var(--ok);
}

.msg.err {
  display:block;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--err);
}

.details { margin-top: 10px; }
.details summary { cursor: pointer; color: var(--muted); }

.pre {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
  max-height: 240px;
}

.mt { margin-top: 12px; }

.grid { display:grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 { display:grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }

.section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0f5;
}

.inline { display:flex; gap:10px; align-items:center; }
.inline label { margin: 0; display:flex; gap:8px; align-items:center; }

.tablewrap {
  overflow:auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 8px; border-bottom: 1px solid #eef2f7; font-size: 12.5px; }
.table th { text-align:left; color: var(--muted); font-weight: 700; }

.compact .row { margin-top: 6px; }
.compact .section { margin-top: 10px; padding-top: 10px; }

@media (max-width: 900px) {
  .grid, .grid2 { display:grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
}

/* ===== Modal ===== */
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  margin: 8vh auto 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.15);
}

.modal-card.xl {
  width: min(1200px, calc(100vw - 24px));
  max-height: 85vh;
  overflow: auto;
}

.modal-card h3 { margin-top: 0; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.linkcell { color: #2563eb; cursor: pointer; font-weight: 600; }
.linkcell:hover { text-decoration: underline; }

.badge { display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; background:#eef2f7; color:#111827; }
.badge.ok { background:#dcfce7; color:#166534; }
.badge.warn { background:#fef3c7; color:#92400e; }
.badge.err { background:#fee2e2; color:#991b1b; }

.warnbox {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 600;
}
.uid { font-family: ui-monospace, Menlo, monospace; font-size:12px; padding:2px 6px; background:#f1f5f9; border-radius:6px; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #ffffff; border-right: 1px solid #e5e7ef; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.nav-brand { font-weight: 800; margin-bottom: 6px; }
.nav-muted { color: #6b7280; font-size: 12px; margin-bottom: 14px; }
.nav a { display:block; padding: 8px 10px; border-radius: 10px; color: #111827; text-decoration: none; font-weight: 600; }
.nav a:hover { background: #f3f4f6; }
.content { padding: 0; }
.small { font-size: 12px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { padding-left: 22px; position: relative; color: #111827; }
.checklist li:before { content: "•"; position: absolute; left: 8px; color: #9ca3af; }
.checklist li.ok:before { content: "✓"; color: #16a34a; }
.checklist li.err:before { content: "×"; color: #dc2626; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .sidebar { position: relative; height: auto; } }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-split { grid-template-columns: 1fr; }
  .ops-toolbar { grid-template-columns: 1fr; }
  .ops-toolbar .btn { width: 100%; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
  .pos-dashboard-head { align-items: stretch; flex-direction: column; }
  .status-pill { align-self: flex-start; }
}

.screen-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.tabbar { display:flex; gap:8px; margin:10px 0 14px; flex-wrap:wrap; }
.tab { border:1px solid #e5e7ef; background:#fff; color:#111827; padding:6px 10px; border-radius:10px; font-weight:700; cursor:pointer; }
.tab.active { background:#2563eb; color:#fff; border-color:#2563eb; }
.tab-panel.hidden { display:none; }


/* ===== Detail-Seite (ohne Sidebar) ===== */
body.detail-view .layout { grid-template-columns: 1fr; }
body.detail-view .sidebar { display: none; }
body.detail-view #sec-session,
body.detail-view #sec-smtp,
body.detail-view #sec-users { display: none !important; }
body.detail-view .wrap { max-width: 1400px; }


.detail-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom: 10px; }
.breadcrumb { font-size: 12px; color: var(--muted); display:flex; align-items:center; gap:6px; }
.breadcrumb .crumb { color:#2563eb; text-decoration:none; font-weight:600; }
.breadcrumb .crumb:hover { text-decoration: underline; }
.detail-grid { display:grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }

body.detail-view .topbar { display:none; }
body.detail-view .card#customerScreen { margin-top: 10px; }

.customer-tabbar {
  display: flex;
  gap: 10px;
  margin: 8px 0 14px;
  padding: 8px 2px 12px;
  border-bottom: 1px solid #e5e7ef;
  overflow-x: auto;
}

.customer-tab {
  border: 1px solid #d8e1ee;
  background: #f7fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.customer-tab:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.customer-tab.active {
  background: linear-gradient(135deg, #0f4c81, #1d70b8);
  border-color: #0f4c81;
  color: #fff;
}

.analytics-placeholder {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
}

.chart-placeholder {
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #475569;
  background: repeating-linear-gradient(
    135deg,
    #f8fafc,
    #f8fafc 10px,
    #f1f5f9 10px,
    #f1f5f9 20px
  );
}

.placeholder-fields {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.placeholder-fields > div {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

/* ===== Detail-Layout (Single-Scroll, kompakt) ===== */
body.detail-view .tabbar { display: none; }
body.detail-view .tab-panel { margin-top: 12px; }
body.detail-view .tab-panel.hidden { display: none !important; }
body.detail-view .table th, body.detail-view .table td { padding: 6px 6px; font-size: 12px; }
body.detail-view .row { margin-top: 6px; }
body.detail-view .section { margin-top: 10px; padding-top: 10px; }


/* Iconbar */
.iconbar { display:flex; gap:8px; align-items:center; }
.icon-btn { border:1px solid #e5e7ef; background:#fff; border-radius:8px; padding:6px 8px; cursor:pointer; font-weight:700; }
.icon-btn:hover { background:#f3f4f6; }

/* More compact tables */
body.detail-view .table th, body.detail-view .table td { padding: 5px 6px; font-size: 12px; }
body.detail-view .pre { max-height: 180px; }
body.detail-view .detail-head { position: sticky; top: 0; background: #fff; padding: 8px 0; z-index: 5; }


.detail-badges { margin-top: 6px; display:flex; gap:8px; flex-wrap:wrap; }
.small-actions .btn { padding: 4px 6px; font-size: 11px; }
.small-actions .muted { font-size: 11px; }
body.detail-view .customer-tabbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}


.filter-row { gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-row label { margin: 0; font-size: 11px; }
.filter-row input, .filter-row select { width: auto; min-width: 120px; padding: 6px 8px; font-size: 12px; }
.filter-row .stats { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.filter-row .stats strong { color: var(--text); }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .placeholder-fields { grid-template-columns: 1fr; }
}

.user-shell {
  max-width: 1200px;
  margin: 24px auto 42px;
  padding: 0 16px;
}

.user-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #dbe6f2;
  background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.user-hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.user-tabbar {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid #dbe3ee;
  padding-bottom: 10px;
  overflow-x: auto;
}

.user-tab {
  border: 1px solid #ced9e8;
  border-radius: 999px;
  background: #f8fbff;
  color: #0f172a;
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.user-tab.active {
  border-color: #114f88;
  background: linear-gradient(135deg, #114f88, #1e73ba);
  color: #fff;
}

.user-panel {
  margin-top: 14px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

@media (max-width: 900px) {
  .user-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Customer operations portal */
.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(42, 116, 128, 0.16), transparent 30rem),
    radial-gradient(circle at 100% 8%, rgba(185, 134, 62, 0.12), transparent 26rem),
    #f4f7f7;
}

.portal-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(28, 76, 84, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(21, 57, 63, 0.1);
  backdrop-filter: blur(20px);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.portal-brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, #164f58, #26808c);
  box-shadow: 0 14px 30px rgba(23, 90, 101, 0.28);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.portal-hero h1,
.portal-section-heading h2,
.portal-card h3 {
  margin: 0;
  color: #102f35;
  letter-spacing: -0.025em;
}

.portal-hero h1 { font-size: clamp(1.45rem, 2vw, 2rem); }
.portal-section-heading h2 { font-size: clamp(1.55rem, 2.5vw, 2.25rem); }
.portal-card h3 { font-size: 1.1rem; }

.portal-eyebrow {
  margin: 0 0 5px;
  color: #36727b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.portal-account {
  margin: 5px 0 0;
  color: #63777b;
  font-size: 0.86rem;
}

.portal-hero-actions,
.portal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-sync-state {
  color: #63777b;
  font-size: 0.82rem;
}

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 9px 15px;
  color: #fff;
  background: #1d6974;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.portal-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(24, 87, 96, 0.16);
}

.portal-button:disabled { cursor: wait; opacity: 0.6; }
.portal-button-secondary { color: #214a51; border-color: #c8d9dc; background: #fff; }
.portal-button-danger { background: #9b3340; }

.portal-notice {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(43, 113, 124, 0.18);
  border-radius: 17px;
  color: #385c62;
  background: rgba(232, 244, 245, 0.88);
  font-size: 0.88rem;
}

.portal-notice strong,
.portal-notice span { display: block; }
.portal-notice span { margin-top: 2px; color: #5d7377; }

.portal-notice-icon {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: #286f79;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-tabs {
  display: inline-flex;
  gap: 5px;
  margin: 18px 0;
  padding: 5px;
  border: 1px solid rgba(27, 74, 82, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 36px rgba(31, 69, 75, 0.07);
  backdrop-filter: blur(18px);
}

.portal-tab {
  min-width: 118px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 9px 16px;
  color: #51696e;
  background: transparent;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
}

.portal-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #174e57, #267b87);
  box-shadow: 0 10px 22px rgba(26, 85, 94, 0.22);
}

.portal-panel {
  padding: 24px;
  border: 1px solid rgba(28, 76, 84, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(21, 57, 63, 0.09);
  backdrop-filter: blur(18px);
}

.portal-panel.hidden { display: none; }

.portal-section-heading,
.portal-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-section-heading { margin-bottom: 20px; }

.portal-status-pill,
.portal-card-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #d4e0e2;
  border-radius: 999px;
  padding: 6px 11px;
  color: #4e676c;
  background: #f4f8f8;
  font-size: 0.75rem;
  font-weight: 780;
  white-space: nowrap;
}

.portal-status-pill[data-status="ok"] { color: #17643f; border-color: #a8d8bf; background: #ecf8f0; }
.portal-status-pill[data-status="attention"] { color: #8c4b12; border-color: #ebc995; background: #fff7e8; }

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.portal-metric-card,
.portal-card {
  border: 1px solid #dbe7e8;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f9fbfb);
  box-shadow: 0 18px 45px rgba(23, 60, 66, 0.06);
}

.portal-metric-card { padding: 18px; }
.portal-metric-label { display: block; min-height: 2.4em; color: #60777b; font-size: 0.78rem; font-weight: 760; }
.portal-metric-value { display: block; margin-top: 10px; color: #123b42; font-size: clamp(1.45rem, 2.5vw, 2.1rem); letter-spacing: -0.04em; }
.portal-metric-card small { display: block; margin-top: 7px; color: #849598; }

.portal-grid { display: grid; gap: 14px; margin-top: 14px; }
.portal-grid-overview { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
.portal-card { padding: 18px; }
.portal-health-card { margin-top: 14px; }

.portal-detail-list { margin: 16px 0 0; }
.portal-detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e6eeee;
}
.portal-detail-list dt { color: #6a7e82; }
.portal-detail-list dd { margin: 0; color: #163c42; font-weight: 750; text-align: right; }

.portal-list { margin-top: 12px; }
.portal-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #e7eeee;
}
.portal-list-row:last-child { border-bottom: 0; }
.portal-list-row strong,
.portal-list-row span { display: block; }
.portal-list-row span { margin-top: 3px; color: #788a8d; font-size: 0.76rem; }
.portal-list-row b { color: #18454c; white-space: nowrap; }
.portal-list-row b.amount-negative { color: #a23542; }

.portal-issues { margin-top: 14px; }
.portal-success,
.portal-issue,
.portal-empty { color: #6e8184; font-size: 0.86rem; }
.portal-success { margin: 0; color: #1a6842; }
.portal-issue { margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff7e8; }
.portal-issue-critical { color: #8b2c39; background: #fff0f2; }

.portal-account-card { max-width: 760px; }
.portal-account-copy { margin: 0 0 20px; color: #60777b; line-height: 1.65; }
.portal-account-form { display: grid; gap: 16px; }
.portal-account-form label { display: grid; gap: 7px; color: #173b41; font-weight: 760; }
.portal-account-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cddcdf;
  border-radius: 12px;
  background: #fff;
  color: #173b41;
  font: inherit;
  padding: 11px 13px;
}
.portal-account-form input:focus-visible {
  outline: 3px solid rgba(35, 126, 140, 0.28);
  outline-offset: 2px;
  border-color: #237e8c;
}
.portal-account-form small,
.portal-form-message { color: #6e8184; font-weight: 500; }
.portal-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 4px; }
.portal-button-primary { border-color: #1c6974; background: #1c6974; color: #fff; }
.portal-recovery-note {
  margin-top: 22px;
  padding: 16px;
  border-radius: 12px;
  background: #f1f6f6;
  color: #60777b;
  line-height: 1.55;
}
.portal-recovery-note strong { color: #173b41; }

.portal-search input {
  width: min(340px, 70vw);
  min-height: 44px;
  border: 1px solid #cddcdf;
  border-radius: 13px;
  padding: 9px 13px;
  color: #173b41;
  background: #fff;
  font: inherit;
}

.portal-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dce7e9;
  border-radius: 16px;
}

.portal-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.portal-table th,
.portal-table td { padding: 13px 14px; border-bottom: 1px solid #e6eeee; text-align: left; vertical-align: middle; }
.portal-table th { color: #5d7377; background: #f5f9f9; font-size: 0.75rem; letter-spacing: 0.035em; text-transform: uppercase; }
.portal-table tbody tr:last-child td { border-bottom: 0; }
.portal-table tbody tr:hover { background: #f8fbfb; }
.portal-table .align-right { text-align: right; }
.portal-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.portal-amount { color: #153f46; font-weight: 780; white-space: nowrap; }
.portal-link { color: #1c6974; font-weight: 780; }
.portal-table .portal-empty { padding: 22px !important; text-align: center !important; }

.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;
}

.portal-button:focus-visible,
.portal-tab:focus-visible,
.portal-search input:focus-visible,
.portal-link:focus-visible {
  outline: 3px solid rgba(35, 126, 140, 0.35);
  outline-offset: 2px;
}

@media (max-width: 1000px) {
  .portal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-grid-overview { grid-template-columns: 1fr; }
  .portal-hero { align-items: flex-start; }
  .portal-hero-actions { justify-content: flex-end; }
}

@media (max-width: 720px) {
  .portal-shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .portal-hero { flex-direction: column; padding: 18px; border-radius: 18px; }
  .portal-hero-actions { width: 100%; justify-content: flex-start; }
  .portal-sync-state { width: 100%; }
  .portal-notice { align-items: flex-start; }
  .portal-tabs { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .portal-tab { min-width: 0; padding-inline: 8px; }
  .portal-panel { padding: 18px 14px; border-radius: 18px; }
  .portal-metrics { grid-template-columns: 1fr 1fr; }
  .portal-section-heading,
  .portal-section-heading-tools,
  .portal-card-heading { align-items: flex-start; flex-direction: column; }
  .portal-toolbar,
  .portal-search,
  .portal-search input { width: 100%; }
}

@media (max-width: 480px) {
  .portal-metrics { grid-template-columns: 1fr; }
  .portal-brand-mark { width: 46px; height: 46px; flex-basis: 46px; }
  .portal-tab { font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-button { transition: none; }
}
