/* =======================================================================
   Monitoring SPM & SP2D — "Segel" Glass UI design system
   Palette: deep treasury-navy backdrop + ministry-gold accent + steel-blue
   Type: Manrope (display) / Inter (body) / IBM Plex Mono (ledger data)
   ======================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@600;700;800&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg-deep: #0a0f1e;
  --bg-mid: #101a33;
  --bg-glow-gold: rgba(212, 175, 55, 0.16);
  --bg-glow-blue: rgba(59, 130, 196, 0.20);

  --glass-fill: rgba(255, 255, 255, 0.055);
  --glass-fill-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-soft: rgba(255, 255, 255, 0.08);

  --gold: #d4af37;
  --gold-soft: #e8cf7a;
  --blue: #4d9fdb;
  --text-primary: #f4f6fb;
  --text-muted: #93a0ba;
  --text-faint: #5f6c86;

  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.14);
  --info-bg: rgba(77, 159, 219, 0.16);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 14px 40px rgba(0, 0, 0, 0.45);

  --font-display: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(900px 500px at 15% -10%, var(--bg-glow-gold), transparent 60%),
    radial-gradient(700px 600px at 100% 0%, var(--bg-glow-blue), transparent 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 88px; /* space for bottom nav */
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }

/* ---------------------------------------------------------------------
   Layout shells
   --------------------------------------------------------------------- */
.app-shell { max-width: 560px; margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(10, 15, 30, 0.55);
  border-bottom: 1px solid var(--glass-border-soft);
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
  margin-top: env(safe-area-inset-top, 0px);
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 auto; }
.topbar-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-seal { display:flex; align-items:center; gap:10px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-fill); border: 1px solid var(--glass-border);
  color: var(--text-primary); cursor: pointer; position: relative;
  transition: background .15s ease, transform .15s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:hover { background: var(--glass-fill-strong); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--gold); border: 2px solid var(--bg-deep);
}

main { padding: 18px 0 24px; }

/* ---------------------------------------------------------------------
   Glass surfaces
   --------------------------------------------------------------------- */
.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-soft);
}

.card { padding: 18px; margin-bottom: 14px; }
.card-strong { background: var(--glass-fill-strong); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.card-desc { font-size: 12.5px; color: var(--text-muted); }

/* Stat tiles on dashboards */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-tile { padding: 14px 10px; text-align: center; }
.stat-num { font-family: var(--font-mono); font-weight: 600; font-size: 22px; }
.stat-label { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile.gold .stat-num { color: var(--gold-soft); }
.stat-tile.blue .stat-num { color: var(--blue); }
.stat-tile.green .stat-num { color: var(--success); }

/* ---------------------------------------------------------------------
   Signature element: the "segel" stage stamp / stepper
   --------------------------------------------------------------------- */
.segel {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.12);
  flex-shrink: 0;
}

.stage-track { display: flex; align-items: center; gap: 6px; margin: 6px 0 2px; }
.stage-dot {
  width: 26px; height: 26px; border-radius: 50%; display:flex; align-items:center; justify-content:center;
  font-size: 11px; font-weight: 700; border: 1.5px solid var(--glass-border); color: var(--text-faint);
  background: rgba(255,255,255,0.03);
}
.stage-dot.done { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.stage-dot.current { border-color: var(--gold); color: var(--gold-soft); background: var(--bg-glow-gold); }
.stage-line { flex: 1; height: 2px; background: var(--glass-border); border-radius: 2px; }
.stage-line.done { background: var(--success); opacity: .6; }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-amber { background: var(--warning-bg); color: var(--warning); }
.badge-blue { background: var(--info-bg); color: var(--blue); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-grey { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
label { display: block; font-size: 12.5px; color: var(--text-muted); margin: 0 0 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=search], input[type=tel], input[type=date], select, textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
  color: var(--text-primary); font-size: 14.5px; font-family: var(--font-body);
  outline: none; transition: border-color .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); background: rgba(255,255,255,0.08); }
.field { margin-bottom: 14px; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-prefix {
  font-family: var(--font-mono); color: var(--text-muted); font-size: 13px;
  padding: 0 10px; white-space: nowrap;
}

/* Multi-SPP input rows (Verifikator) */
.spp-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.spp-row input { flex: 1; }
.spp-preview { font-family: var(--font-mono); font-size: 12px; color: var(--gold-soft); margin-top: 5px; }
.remove-row {
  width: 40px; height: 44px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--danger-bg); border: 1px solid rgba(248,113,113,0.3); color: var(--danger);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: var(--radius-sm); border: none;
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: transform .12s ease, filter .15s ease; width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--gold), #b8912a); color: #1a1305; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--glass-fill-strong); border: 1px solid var(--glass-border); color: var(--text-primary); }
.btn-ghost { background: transparent; border: 1px dashed var(--glass-border); color: var(--text-muted); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.fab {
  position: fixed; right: 18px; bottom: 96px; z-index: 45;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8912a);
  color: #1a1305; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lift); border: none; cursor: pointer; font-size: 26px;
}

/* ---------------------------------------------------------------------
   List / item rows (SPP queue, monitoring items)
   --------------------------------------------------------------------- */
.item {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px;
  border-radius: var(--radius-md); margin-bottom: 10px;
  background: var(--glass-fill); border: 1px solid var(--glass-border-soft);
}
.item-check {
  width: 22px; height: 22px; border-radius: 6px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--gold);
}
.item-body { flex: 1; min-width: 0; }
.item-no { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; color: var(--gold-soft); }
.item-title { font-size: 13.5px; margin-top: 3px; color: var(--text-primary); }
.item-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.item-amount { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); margin-top: 6px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .segel { margin: 0 auto 14px; width: 54px; height: 54px; font-size: 20px; }
.empty-state p { font-size: 13px; margin-top: 6px; }

/* ---------------------------------------------------------------------
   Bottom nav (PWA app-shell feel)
   --------------------------------------------------------------------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--glass-border-soft);
}
.bottom-nav-inner { max-width: 560px; margin: 0 auto; display: flex; justify-content: space-around; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-faint); font-size: 10.5px; padding: 4px 10px; border-radius: 12px; }
.nav-item.active { color: var(--gold-soft); }
.nav-item svg { width: 21px; height: 21px; }

/* ---------------------------------------------------------------------
   Toast / alert banners
   --------------------------------------------------------------------- */
.toast-wrap { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 78px); left: 0; right: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 92%; padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lift);
  background: var(--glass-fill-strong); border: 1px solid var(--glass-border); backdrop-filter: blur(14px);
  animation: toast-in .25s ease;
}
.toast.ok { border-color: rgba(52,211,153,0.4); color: var(--success); }
.toast.err { border-color: rgba(248,113,113,0.4); color: var(--danger); }
@keyframes toast-in { from { opacity:0; transform: translateY(-8px);} to {opacity:1; transform:none;} }

.alert { padding: 12px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 14px; }
.alert-err { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.alert-ok { background: var(--success-bg); color: var(--success); border: 1px solid rgba(52,211,153,0.3); }
.alert-info { background: var(--info-bg); color: var(--blue); border: 1px solid rgba(77,159,219,0.3); }

/* ---------------------------------------------------------------------
   Login screen
   --------------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 34px 26px; text-align: center; }
.login-seal { width: 68px; height: 68px; margin: 0 auto 16px; border-radius: 50%; border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 6px rgba(212,175,55,0.10); }
.login-title { font-size: 19px; margin-bottom: 4px; }
.login-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 26px; }

/* ---------------------------------------------------------------------
   Filter bar (PIC)
   --------------------------------------------------------------------- */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 14px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600;
  background: var(--glass-fill); border: 1px solid var(--glass-border); color: var(--text-muted); cursor: pointer;
}
.chip.active { background: rgba(212,175,55,0.16); border-color: var(--gold); color: var(--gold-soft); }

/* ---------------------------------------------------------------------
   Table (desktop-widened views: admin user table, upload preview)
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--glass-border-soft); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--glass-border-soft); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; background: rgba(255,255,255,0.03); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5,8,16,0.6); backdrop-filter: blur(4px); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal-sheet { width: 100%; max-width: 560px; padding: 22px 18px calc(22px + env(safe-area-inset-bottom,0px)); border-radius: 22px 22px 0 0; background: var(--bg-mid); border: 1px solid var(--glass-border); border-bottom: none; max-height: 85vh; overflow-y: auto; }
.modal-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--glass-border); margin: 0 auto 16px; }

.section-title { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

.help-text { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.5; }

.divider { height: 1px; background: var(--glass-border-soft); margin: 16px 0; }

@media (min-width: 620px) {
  .app-shell { max-width: 640px; }
}
