/* ============================================================
   Ausweblabs Scheme Manager — premium mobile-first banking UI
   Soft green on white, rounded cards, subtle shadows.
   ============================================================ */

:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-soft: #ecfdf5;
  --primary-ink: #064e3b;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e6ebea;
  --danger: #e11d48;
  --danger-soft: #fff1f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
  --maxw: 1120px;
  --sidebar: 230px;
  --nav-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}
.topbar-actions { display:flex; align-items:center; gap:12px; }
.hamburger-btn { display:none; background:none; border:none; cursor:pointer; color:var(--text); padding:4px; }
.mobile-menu { display:none; position:fixed; top:var(--nav-h); right:0; width:280px; max-height:calc(100vh - var(--nav-h)); background:var(--surface); border-left:1px solid var(--border); box-shadow:var(--shadow-lg); z-index:50; padding:16px; overflow-y:auto; animation:slideInRight .2s ease; }
.mobile-menu.open { display:block; }
.mobile-menu-header { display:flex; align-items:center; gap:12px; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.mobile-menu-section { margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.mobile-menu .btn.block { display:flex; justify-content:flex-start; margin-bottom:4px; }
@keyframes slideInRight { from{transform:translateX(100%);opacity:0;} to{transform:none;opacity:1;} }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand .dot {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.topbar .spacer { flex: 1; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 700;
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--nav-h)); align-items: flex-start; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 500; margin-bottom: 4px;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: var(--primary-soft); color: var(--primary-ink); }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 14px 6px; }
.content { flex: 1; padding: 28px 24px 80px; min-width: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.card .muted { color: var(--muted); font-size: 13px; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; text-align:center;
}
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.green { background: linear-gradient(135deg, #ecfdf5, #ffffff); border-color: #a7f3d0; }
.stat .accent { position: absolute; top: 0; right: 0; width: 90px; height: 90px; border-radius: 50%; background: var(--primary-soft); transform: translate(30px, -40px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; border: 0;
  padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .05s, opacity .15s;
  min-height: 44px;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #be123c; }
.btn.ghost { background: transparent; color: var(--primary-dark); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; min-height: 36px; border-radius: 10px; }
.btn.inline-form { margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.errorlist { list-style: none; background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.field .errorlist { margin-bottom: 6px; padding: 8px 10px; }

/* Radio & checkbox — custom, clean, tappable */
.field input[type="radio"],
.field input[type="checkbox"],
input[type="radio"].form-control,
input[type="checkbox"].form-control {
  width: 18px; height: 18px; accent-color: var(--primary);
  margin-right: 8px; vertical-align: middle; cursor: pointer;
}
.field label + input[type="radio"],
.field label + input[type="checkbox"] { margin-top: 2px; }
input[type="radio"] + label,
input[type="checkbox"] + label {
  display: inline; font-size: 14px; font-weight: 400; cursor: pointer;
}
/* Radio group row / inline */
.radio-group, .checkbox-group { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.radio-group label, .checkbox-group label { display: inline-flex; align-items: center; gap: 6px; }

/* Standalone search input (outside .field) */
input[type="search"] {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
input[type="search"]:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}
/* General text/number/date standalone */
input[type="text"]:not(.field input):not(.searchbar input),
input[type="number"]:not(.field input),
input[type="date"]:not(.field input),
select:not(.field select),
textarea:not(.field textarea) {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus:not(.field input),
input[type="number"]:focus:not(.field input),
input[type="date"]:focus:not(.field input),
select:focus:not(.field select),
textarea:focus:not(.field textarea) {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}

/* as-table variant (page-specific like expense list) */
.as-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.as-table th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.as-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.as-table tr:hover td { background: var(--primary-soft); }
.text-right { text-align: right; }
.w-full { width: 100%; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.ml { margin-left: 0.5rem; }
.top-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.top-bar .h1 { font-size: 22px; font-weight: 800; margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: var(--primary-soft); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted);
}
.badge.green { background: var(--primary-soft); color: var(--primary-dark); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.blue { background: var(--info-soft); color: var(--info); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 76px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 12px 16px; min-width: 260px; max-width: 360px;
  border-left: 4px solid var(--primary);
  animation: slideIn .25s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 20px; padding: 24px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin-bottom: 6px; }
.modal .close { float: right; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, #eef1ef 25%, #f7f9f8 50%, #eef1ef 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Hero / public ---------- */
.hero {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 32px;
}
.hero .container { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hero img.cover { border-radius: 20px; max-height: 260px; width: 100%; object-fit: cover; }
.hero .logo { width: 88px; height: 88px; border-radius: 22px; object-fit: cover; box-shadow: var(--shadow); background: #fff; }
.hero h1 { font-size: 32px; font-weight: 800; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gallery img { width: 100%; height: 160px; object-fit: cover; border-radius: 14px; }

/* ---------- Client quick actions ---------- */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.action {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; text-align: center; cursor: pointer; transition: transform .1s, box-shadow .15s;
}
.action:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action .icon { font-size: 22px; margin-bottom: 6px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.searchbar { display: flex; gap: 10px; align-items: center; }
.searchbar input { flex: 1; }
.right { margin-left: auto; }
.balance-hero { font-size: 34px; font-weight: 800; letter-spacing: -.01em; }

/* Bottom navigation (mobile) */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 6px 4px;
}
.bottom-nav a.active { color: var(--primary-dark); font-weight: 600; }
.bottom-nav a svg, .bottom-nav a .ico { font-size: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .layout { display: block; }
  .content { padding: 18px 14px 110px; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; justify-content: space-around; }
  .hero h1 { font-size: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hamburger-btn { display: block; }
  .user-chip .name, .user-chip form { display:none; }
  .user-chip .avatar { width:36px; height:36px; }
  .topbar-badge { display:none; }
  .theme-wrapper { display:none !important; }
  .brand span { font-size:14px; }

  /* Tables become cards on mobile */
  .data thead, .as-table thead { display:none; }
  .data tbody tr, .as-table tbody tr {
    display:block; border:1px solid var(--border); border-radius:12px;
    padding:12px; margin-bottom:10px; background:var(--surface);
    box-shadow:var(--shadow);
  }
  .data td, .as-table td { display:flex; justify-content:space-between; align-items:center; padding:6px 0; border-bottom:none; }
  .data td::before, .as-table td::before {
    content:attr(data-label); font-size:11px; font-weight:600;
    color:var(--muted); text-transform:uppercase; letter-spacing:.04em;
    margin-right:12px; flex-shrink:0; display:none;
  }
  .data td[data-label]::before, .as-table td[data-label]::before { display:inline; }
  .data td, .as-table td { font-size:14px; }
  .data .actions, .as-table .actions { justify-content:flex-end; }
  .data tr:hover td, .as-table tr:hover td { background:transparent; }
}
@media (max-width: 460px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 19px; }
  .topbar .user-chip .name { display: none; }
}

/* Print-friendly receipts */
@media print {
  .topbar, .sidebar, .bottom-nav, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* Site footer */
.site-footer {
  padding: 16px 0 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
