:root {
  color-scheme: dark;
  --bg: #081017;
  --surface: #101b24;
  --surface-2: #16242f;
  --line: #263847;
  --text: #edf5f7;
  --muted: #9eb0bd;
  --accent: #62e6c1;
  --accent-ink: #06231d;
  --warn: #f2b84b;
  --danger: #ef6461;
  --ok: #6fda8b;
  --shadow: 0 14px 40px rgba(0,0,0,.25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.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; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 15%, rgba(98,230,193,.12), transparent 38%), var(--bg);
}
.login-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.brand-logo { width: 56px; height: 56px; border-radius: 14px; }
.brand-lockup h1 { margin: 0; font-size: 1.55rem; }
.brand-lockup p { margin: 4px 0 0; color: var(--muted); }
.field { display: grid; gap: 7px; margin: 16px 0; }
.field label { color: var(--muted); font-size: .92rem; }
.field input {
  width: 100%; min-height: 50px; border-radius: 13px; border: 1px solid var(--line);
  background: #0b141c; color: var(--text); padding: 0 14px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98,230,193,.14); }
.btn {
  min-height: 48px; border: 0; border-radius: 13px; padding: 0 18px; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 700;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid rgba(98,230,193,.38); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-danger { background: rgba(239,100,97,.15); color: #ff9c99; border: 1px solid rgba(239,100,97,.35); }
.btn-block { width: 100%; }
.form-error { min-height: 1.25rem; color: #ff9c99; margin-top: 12px; }
.status-line { display:flex; align-items:center; gap:8px; margin-top:18px; color:var(--muted); font-size:.9rem; }
.status-dot { width:10px; height:10px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 4px rgba(111,218,139,.1); }
.status-dot.offline { background: var(--danger); box-shadow:0 0 0 4px rgba(239,100,97,.1); }
.status-dot.syncing { background: var(--warn); box-shadow:0 0 0 4px rgba(242,184,75,.1); animation:pulse 1s infinite alternate; }
@keyframes pulse { to { opacity:.45; transform:scale(.85); } }

.app-shell { min-height:100vh; }
.topbar {
  height: 68px; display:flex; align-items:center; justify-content:space-between; gap:12px;
  position:sticky; top:0; z-index:20; padding:0 16px; background:rgba(8,16,23,.94);
  backdrop-filter: blur(16px); border-bottom:1px solid var(--line);
}
.topbar-left, .topbar-right { display:flex; align-items:center; gap:10px; }
.icon-btn { width:48px; height:48px; border-radius:14px; border:1px solid var(--line); background:var(--surface); color:var(--text); cursor:pointer; font-size:1.25rem; }
.wordmark { font-weight:800; letter-spacing:.01em; }
.connectivity { display:flex; align-items:center; gap:7px; font-size:.85rem; color:var(--muted); }
.main { width:min(1100px, 100%); margin:0 auto; padding:22px 16px 80px; }
.hero { margin-bottom:18px; }
.hero h1 { margin:0 0 6px; font-size:clamp(1.7rem, 6vw, 2.5rem); }
.hero p { margin:0; color:var(--muted); }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:0 10px 24px rgba(0,0,0,.12); }
.card h2, .card h3 { margin:0 0 8px; }
.metric { font-size:2rem; font-weight:800; margin:8px 0; }
.badge { display:inline-flex; align-items:center; min-height:30px; padding:0 10px; border-radius:999px; font-size:.82rem; font-weight:700; background:rgba(98,230,193,.12); color:var(--accent); border:1px solid rgba(98,230,193,.25); }

.drawer-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.52); z-index:29; }
.drawer { position:fixed; z-index:30; inset:0 auto 0 0; width:min(86vw,340px); background:#0c151d; border-right:1px solid var(--line); transform:translateX(-105%); transition:transform .18s ease; padding:18px; overflow:auto; }
.drawer.open { transform:translateX(0); }
.drawer-head { display:flex; align-items:center; gap:12px; margin:5px 0 18px; }
.drawer-head img { width:44px; height:44px; border-radius:12px; }
.menu { display:grid; gap:8px; }
.menu button { min-height:50px; text-align:left; border:1px solid transparent; border-radius:13px; padding:0 14px; background:transparent; color:var(--text); cursor:pointer; }
.menu button:hover, .menu button.active { background:var(--surface); border-color:var(--line); }
.drawer-footer { margin-top:24px; padding-top:18px; border-top:1px solid var(--line); }

.toolbar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between; margin-bottom:16px; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; }
table { width:100%; border-collapse:collapse; min-width:650px; }
th, td { padding:13px 14px; text-align:left; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-size:.86rem; font-weight:700; background:#0c151d; }
tr:last-child td { border-bottom:0; }
.inline-actions { display:flex; gap:8px; flex-wrap:wrap; }
.inline-actions .btn { min-height:40px; }
.modal-backdrop { position:fixed; inset:0; z-index:40; background:rgba(0,0,0,.62); display:grid; place-items:center; padding:18px; }
.modal { width:min(100%,520px); max-height:90vh; overflow:auto; background:var(--surface); border:1px solid var(--line); border-radius:20px; padding:20px; box-shadow:var(--shadow); }
.modal h2 { margin-top:0; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.notice { border:1px solid rgba(242,184,75,.3); background:rgba(242,184,75,.08); color:#f8d993; padding:12px 14px; border-radius:13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:.9rem; overflow-wrap:anywhere; }

@media (max-width: 620px) {
  .form-row { grid-template-columns:1fr; }
  .main { padding-top:16px; }
}

.stack-gap { margin-top: 14px; }
.success-text { color: var(--ok) !important; }

/* ==========================================================
   VeaStock installed-module shell integration
   ========================================================== */

.home-status {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
  margin-bottom:22px;
}

.section-heading {
  margin:24px 0 12px;
}

.section-heading h2 {
  margin:0;
  font-size:1.15rem;
}

.action-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:12px;
}

.action-card {
  min-height:96px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:12px;
  padding:17px;
  text-decoration:none;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:17px;
  box-shadow:0 10px 24px rgba(0,0,0,.12);
}

.action-card:hover {
  border-color:rgba(98,230,193,.55);
  transform:translateY(-1px);
}

.action-card:focus-visible {
  outline:3px solid rgba(98,230,193,.38);
  outline-offset:2px;
}

.action-card strong {
  font-size:1.03rem;
}

.action-card span {
  color:var(--accent);
  font-weight:700;
  font-size:.88rem;
}

.btn-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

/*
 * Connectivity must not rely on green/red color alone.
 * Keep the status text visible on phones too.
 */
@media (max-width: 620px) {
  .connectivity {
    font-size:.72rem;
    white-space:nowrap;
  }

  .connectivity .label-long {
    display:inline !important;
  }

  .action-grid {
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width: 390px) {
  .action-grid {
    grid-template-columns:1fr;
  }

  .wordmark {
    font-size:.92rem;
  }
}
