/* ======================================================
   SimpleFLO Unified Theme
   ------------------------------------------------------
   This file merges the former:
     - /assets/css/portal.css
     - /assets/css/settings-invoices.css
   into one master stylesheet for all admin/portal pages.
   ====================================================== */

/* ===========================
   Root Variables & Base
   =========================== */
:root {
  --bg: #fff;
  --bg2: #fff;
  --ink: #000;
  --muted: #777;
  --brand: #000;
  --brand2: #000;
  --accent: #000;
}

* { box-sizing: border-box; }
.theme-transition * {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica Neue, Arial;
}

/* Links */
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; opacity: .9; }

/* ===========================
   Header & Navigation
   =========================== */
header {
  background: var(--bg2);
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--brand);
}
.brand img { height: 36px; width: auto; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
}
.site-nav a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#pwaInstallBtn {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  color: var(--ink);
}

/* ===========================
   Buttons
   =========================== */
button,
.btn {
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: linear-gradient(135deg,var(--brand),var(--brand2));
  color: #fff;
  font-weight: 600;
  line-height: 1;
  transition: transform .15s ease, opacity .2s ease;
}
button:hover,
.btn:hover {
  opacity: .95;
  transform: translateY(-1px);
}
.site-nav .btn.active { border-bottom: 2px solid var(--accent); }

.btn.secondary {
  background: linear-gradient(135deg,#f8fafc,#e2e8f0);
  color: var(--ink);
  border: 1px solid #cbd5e1;
}
.btn.secondary:hover {
  opacity: .95;
  transform: translateY(-1px);
}
.btn.back-light {
  background: #f3f4f6;
  color: #111827;
}
.btn.back-light:hover {
  background: #e5e7eb;
}

/* ===========================
   Forms & Inputs
   =========================== */
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  margin-bottom: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.15);
  outline: none;
}
input::placeholder,
textarea::placeholder { color: var(--muted); }
input:-webkit-autofill {
  box-shadow: 0 0 0 1000px #fff inset !important;
  -webkit-text-fill-color: var(--ink) !important;
}

/* ===========================
   Main Layout
   =========================== */
main { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }
h1 { font-size: clamp(32px,6vw,56px); color: var(--brand); }
h2 { font-size: clamp(24px,4vw,36px); margin-top: 60px; color: var(--ink); }
p { max-width: 780px; margin: 0 auto; }

/* ===========================
   Cards
   =========================== */
.card {
  background: var(--bg2);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.card h3 { margin-top: 0; color: var(--ink); }

/* ===========================
   Tables
   =========================== */
.table-wrap { max-width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.table th { color: var(--muted); text-align: left; }
.force-wrap { word-break: break-word; overflow-wrap: anywhere; }

/* Button layout helpers */
.btn { display:inline-block; margin:4px 4px 4px 0; white-space:nowrap; vertical-align:middle; }
.card .btn, .actions .btn { margin:4px; }
.actions, .card, main { flex-wrap: wrap; }

/* ===========================
   Footer
   =========================== */
footer {
  padding: 40px 20px;
  border-top: 1px solid #e2e8f0;
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
footer a { color: var(--brand); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===========================
   Helpers
   =========================== */
.dyor { font-weight:bold; text-transform:uppercase; color:var(--accent); }

/* ===========================
   Dropdown Menu (Allocations)
   =========================== */
.dropdown { position:relative; display:inline-block; }
.dropbtn {
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color:#fff; padding:10px 16px; border:none; border-radius:8px;
  cursor:pointer; font-weight:600;
}
.dropdown-content {
  display:none; position:absolute; background:#fff; min-width:200px;
  border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,0.1);
  z-index:999; overflow:hidden;
}
.dropdown-content a {
  color:var(--ink); padding:10px 14px; text-decoration:none; display:block;
  border-bottom:1px solid #f1f5f9;
}
.dropdown-content a:last-child { border-bottom:none; }
.dropdown-content a:hover { background:var(--brand); color:#fff; }
.dropdown:hover .dropdown-content { display:block; }
.dropdown-content.show { display:block; }

/* ===========================
   Auth Pages (login, forgot, reset)
   =========================== */
.auth-page {
  display:flex; justify-content:center; align-items:center;
  min-height:100vh; background:var(--bg); padding:20px;
}
.auth-wrap { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; min-height:100vh; }
.auth-card {
  background:var(--bg2); border:1px solid #e2e8f0; border-radius:16px;
  padding:32px 28px; width:100%; max-width:420px;
  box-shadow:0 4px 20px rgba(0,0,0,.05); animation:fadeInUp .4s ease;
}
.auth-card h1 {
  color:var(--brand); font-size:1.75rem; text-align:center; margin-bottom:1rem;
}
.auth-card img.logo { display:block; width:160px; margin:0 auto 20px; }
.auth-card p.error {
  color:#e11d48; background:#fee2e2; border:1px solid #fecaca;
  padding:8px 12px; border-radius:8px; text-align:center; margin-bottom:1rem;
}
.auth-card form { display:flex; flex-direction:column; gap:10px; }
.auth-footer { text-align:center; color:var(--muted); font-size:.9rem; margin-top:24px; }
.auth-footer a { color:var(--brand); text-decoration:none; }
.auth-footer a:hover { text-decoration:underline; }
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(12px); }
  to { opacity:1; transform:translateY(0); }
}

/* ===========================
   Dashboard Layout & Quick Start
   =========================== */
.cards {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(320px,1fr));
  gap:1.5rem; margin-bottom:2rem;
}
.quick-start {
  background:#ecfdf5; border-left:5px solid #10b981;
  padding:1.5rem; border-radius:12px; margin-bottom:2rem;
  box-shadow:0 2px 6px rgba(0,0,0,0.05); animation:fadeInUp .4s ease;
}
.quick-start h2 {
  margin-top:0; color:var(--ink); font-size:1.5rem; margin-bottom:.5rem;
}
.quick-start p { color:var(--muted); margin-bottom:.75rem; max-width:700px; }
.quick-start .btn { margin-top:1rem; margin-right:.5rem; }
@media (min-width:900px){ .cards{grid-template-columns:repeat(3,1fr);} }

/* ===========================
   Terms & Policy Pages
   =========================== */
.terms-policy {
  background:#fff; border-radius:16px; padding:40px 50px;
  box-shadow:0 4px 15px rgba(0,0,0,0.05); color:#333;
  max-width:900px; margin:40px auto;
}
.terms-policy h1 { font-size:2rem; font-weight:700; margin-bottom:.5em; color:#111; }
.terms-policy h2 { font-size:1.25rem; font-weight:600; margin-top:1.5em; color:var(--accent); }
.terms-policy p { margin:.75em 0; }
.terms-policy a { color:var(--accent); text-decoration:none; }
.terms-policy a:hover { text-decoration:underline; }
.terms-policy .updated { color:#777; font-size:.9rem; margin-bottom:1em; }
.footer-legal { font-size:.85rem; color:#666; margin-top:10px; }
.footer-legal a { color:var(--accent); }

/* ===========================
   Select Dropdown Visibility Fixes
   =========================== */
select {
  background-color:#fff; color:#000; border:1px solid #ccc;
  border-radius:6px; padding:8px 10px; font-size:1rem;
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  line-height:1.4; position:relative; z-index:5;
}
select option { background-color:#fff; color:#000; }
.card select { background-color:#fff; color:#000; border-color:#bbb; }
.table tr:nth-child(even){ background: rgba(255,255,255,0.02); }
.table tr:last-child{ border-top:1px solid rgba(255,255,255,0.15); }
.field-wrap {
  position: relative;
  margin-bottom: 12px;
}

.field-wrap input[type="password"],
.field-wrap input[type="text"] {
  width: 100%;
  padding: 10px 40px 10px 12px; /* leave room for eye */
  font-size: 15px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  height: 42px;
  box-sizing: border-box;
}

/* 👁️ Centered Eye Icon */
.toggle-eye {
  position: absolute;
  right: 10px;
  top: 0;
  bottom: 0;
  margin: auto;
  height: 18px;
  width: 24px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280; /* slate-500 */
  transition: color 0.2s ease;
}
.toggle-eye:hover {
  color: #0ea5e9; /* blue-500 */
}

.match-ok {
  color: #16a34a;
  font-weight: 600;
}
.match-bad {
  color: #e11d48;
  font-weight: 600;
}
/* --- SimpleFLO Quote & Invoice Forms --- */
.item-row {
  display: grid;
  grid-template-columns: 2fr 100px 120px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.item-row input[type="text"],
.item-row input[type="number"] {
  padding: 6px 8px;
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-input, #fff);
}

.recurring-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 20px;
  margin-top: 6px;
}

.item-row label {
  font-size: 13px;
  color: var(--muted, #666);
}

#quoteTotal {
  font-weight: 600;
  display: inline-block;
  margin-left: 4px;
}

/* Optional subtle divider */
.item-row + .item-row {
  border-top: 1px dashed #e5e7eb;
  padding-top: 6px;
}
.recurring-toggle {
  margin-top: 4px;
  margin-left: 20px;
}
.recurring-toggle label {
  font-size: 14px;
  color: var(--muted);
}
.recurring-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
/* ==========================
   Layout Utilities
   ========================== */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ==========================
   Quote / Invoice Logos
   ========================== */
.card img[alt="Logo"],
.invoice-header img,
header img[alt="Business Logo"] {
  display: block;
  max-height: 80px;
  height: auto;
  margin-left: auto; /* Aligns logo to right */
  object-fit: contain;
}
.onboarding-card ul {
  list-style: none;
  padding-left: 0;
}

.onboarding-card li {
  margin: 6px 0;
}

.expense-controls {
  margin-bottom: 1.25rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.summary-inline {
  font-size: 0.9rem;
  opacity: 0.85;
}

.summary-inline .muted {
  opacity: 0.6;
  margin-left: 0.25rem;
}

.filter-tabs {
  display: inline-flex;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  padding: 4px;
  border-radius: 8px;
}

.filter-tabs a {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.filter-tabs a.active {
  background: rgba(255,255,255,0.15);
}

.main-pot-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.main-pot-header span.pot-total {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.75;
}
.pot-total {
  font-size: 0.95rem;
  font-weight: 600;
  color: #555;
}

.sub-pot-header {
  margin-top: 0.85rem;
  margin-bottom: 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  opacity: 0.85;
}
.sub-pot-header:hover {
  background: rgba(255,255,255,0.07);
}
.sub-pot-group.collapsed {
  display: none;
}
.sub-pot-group {
  margin-left: 0.25rem;
}
.toggle-indicator {
  font-size: 0.85rem;
  opacity: .7;
}

.data-table {
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
}

.data-table td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  padding-left: .5rem;
  line-height: 1.35;
}
.data-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  padding-bottom: 0.35rem;
}
