/* ═══════════════════════════════════════════════
   Remo Solutions 2020 — Main Stylesheet
═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0ede6;
  --surface: #faf9f6;
  --border: #d4cfc4;
  --text: #1a1916;
  --muted: #6b6760;
  --accent: #001f5b;
  --accent-light: #dce8f7;
  --accent-dark: #001040;
  --green: #1a6b2a;
  --brown: #8B4513;
  --gold: #c8a400;
  --danger: #c0392b;
  --warning: #e67e22;
  --ink: #0f1923;
}

body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }

/* ── NAV ── */
.topnav { background: var(--ink); height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 100; }
.topnav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo-box { background: var(--brown); color: white; font-weight: 900; font-size: 0.55rem; border-radius: 6px; padding: 4px 6px; line-height: 1.3; text-align: center; letter-spacing: 0.05em; }
.brand-name { font-family: 'Fraunces', serif; font-size: 1rem; font-weight: 700; color: white; display: block; }
.brand-sub { font-size: 0.6rem; color: rgba(255,255,255,0.4); letter-spacing: 0.08em; text-transform: uppercase; }
.topnav-right { display: flex; align-items: center; }
.nav-user-wrap { display: flex; align-items: center; gap: 8px; color: #ccc; font-size: 0.85rem; cursor: pointer; position: relative; }
.nav-avatar { width: 32px; height: 32px; background: var(--brown); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: white; }
.user-dropdown { display: none; position: absolute; top: calc(100% + 14px); right: 0; background: white; border: 1px solid var(--border); border-radius: 10px; width: 220px; box-shadow: 0 8px 28px rgba(0,0,0,0.15); overflow: hidden; z-index: 200; }
.user-dropdown.open { display: block; }
.dd-header { padding: 0.9rem 1rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.dd-name { font-weight: 600; font-size: 0.875rem; }
.dd-email { font-size: 0.75rem; color: var(--muted); margin-top: 1px; }
.dd-role { display: inline-block; margin-top: 5px; background: var(--accent-light); color: var(--accent); font-size: 0.68rem; padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.dd-item { display: block; padding: 0.65rem 1rem; font-size: 0.85rem; color: var(--text); text-decoration: none; transition: background 0.15s; }
.dd-item:hover { background: var(--bg); }
.dd-item.danger { color: var(--danger); }

/* ── LAYOUT ── */
.app-shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 215px; background: var(--surface); border-right: 1px solid var(--border); padding: 1.25rem 0; flex-shrink: 0; }
.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-label { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 0 1.1rem; margin-bottom: 0.3rem; }
.sidebar-item { display: flex; align-items: center; gap: 9px; padding: 0.5rem 1.1rem; font-size: 0.85rem; color: var(--muted); cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s; text-decoration: none; }
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-light); font-weight: 600; }
.sidebar-item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.main-content { flex: 1; padding: 1.75rem 2rem; overflow-y: auto; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.75rem; }
.page-title { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 600; color: var(--ink); }
.page-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* ── STATS ── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.3rem; transition: box-shadow 0.2s; }
.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
.stat-label { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; font-family: 'DM Mono', monospace; margin-bottom: 0.35rem; }
.stat-value { font-size: 1.6rem; font-weight: 600; color: var(--ink); font-family: 'Fraunces', serif; }
.stat-delta { font-size: 0.72rem; margin-top: 3px; }

/* ── CARD ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 1.25rem; }
.card-header { padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: white; }
.card-title { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.card-body { padding: 1.4rem; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th { text-align: left; padding: 0.55rem 0.9rem; font-family: 'DM Mono', monospace; font-size: 0.67rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap; }
tbody tr { border-bottom: 1px solid #ece9e2; transition: background 0.15s; }
tbody tr:hover { background: #f5f3ee; }
tbody td { padding: 0.75rem 0.9rem; vertical-align: middle; }
.mono { font-family: 'DM Mono', monospace; font-size: 0.78rem; color: var(--muted); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.badge-paid    { background: #d5f5e3; color: #1a6b2a; }
.badge-part    { background: #fef3cd; color: #7d4e00; }
.badge-unpaid  { background: #e8edf5; color: #001f5b; }
.badge-overdue { background: #fde8e6; color: #7d1a12; }
.badge-admin   { background: #e8e0ff; color: #4a1d96; }
.badge-staff   { background: var(--accent-light); color: var(--accent); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 0.5rem 1.1rem; border-radius: 7px; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.18s; font-family: 'DM Sans', sans-serif; text-decoration: none; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,31,91,0.3); }
.btn-brown { background: var(--brown); color: white; }
.btn-brown:hover { background: #7a3b10; }
.btn-outline { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fde8e6; color: var(--danger); border: 1px solid #f5c6c2; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 3px 9px; font-size: 0.78rem; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #155a22; }

/* ── FORMS ── */
.form-grid { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.75rem; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; font-family: 'DM Mono', monospace; }
.field input, .field select, .field textarea {
  padding: 0.55rem 0.75rem; border: 1.5px solid var(--border); border-radius: 7px;
  font-family: 'DM Sans', sans-serif; font-size: 0.875rem; background: white;
  color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,31,91,0.1);
}
.field textarea { min-height: 80px; resize: vertical; }
.field-hint { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ── PROPERTY CHECKBOXES ── */
.prop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.prop-item { display: flex; align-items: center; gap: 6px; background: white; border: 1.5px solid var(--border); border-radius: 7px; padding: 6px 10px; cursor: pointer; transition: all 0.15s; font-size: 0.82rem; }
.prop-item:hover { border-color: var(--accent); }
.prop-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.prop-item.selected { border-color: var(--accent); background: var(--accent-light); }
.prop-qty { width: 44px; padding: 2px 5px; border: 1px solid var(--border); border-radius: 4px; font-size: 0.8rem; text-align: center; }

/* ── TOOLBAR ── */
.toolbar { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; }
.search-wrap input { padding: 0.45rem 0.75rem 0.45rem 2rem; border: 1px solid var(--border); border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; background: white; outline: none; width: 240px; }
.search-wrap input:focus { border-color: var(--accent); }
select.filter { padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: 7px; font-size: 0.85rem; background: white; outline: none; cursor: pointer; }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,25,35,0.65); backdrop-filter: blur(3px); z-index: 300; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; animation: fadeIn 0.2s; }
.modal-box { background: white; border-radius: 12px; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.25); }
.modal-box.wide { max-width: 900px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: white; z-index: 1; }
.modal-title { font-weight: 600; font-size: 0.95rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { display: flex; gap: 0.65rem; justify-content: flex-end; padding: 1rem 1.4rem; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: white; }
.close-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 5px; }
.close-btn:hover { background: var(--bg); }

/* ── FLASH ── */
.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; font-size: 0.875rem; }
.flash button { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.6; }
.flash-success { background: #d5f5e3; color: #1a6b2a; border: 1px solid #a9dfbf; }
.flash-error   { background: #fde8e6; color: var(--danger); border: 1px solid #f5c6c2; }
.flash-info    { background: var(--accent-light); color: var(--accent); border: 1px solid #a9c4e8; }

/* ── TOAST ── */
#toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--ink); color: white; padding: 0.7rem 1.2rem; border-radius: 9px; font-size: 0.875rem; z-index: 999; box-shadow: 0 8px 24px rgba(0,0,0,0.2); transform: translateY(20px); opacity: 0; transition: all 0.3s; pointer-events: none; }
#toast.show { transform: translateY(0); opacity: 1; }

/* ── TWO COL ── */
.two-col { display: grid; grid-template-columns: 1fr 380px; gap: 1.25rem; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab { padding: 0.6rem 1.2rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--green); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; stroke: var(--border); fill: none; stroke-width: 1.5; margin-bottom: 0.75rem; }

/* ── AUTH PAGE ── */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-left { width: 400px; flex-shrink: 0; background: var(--ink); display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; position: relative; overflow: hidden; }
.auth-left::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 80%, rgba(139,69,19,0.3) 0%, transparent 60%); pointer-events: none; }
.auth-brand-big { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 700; color: white; position: relative; z-index: 1; }
.auth-hero { position: relative; z-index: 1; }
.auth-hero h2 { font-family: 'Fraunces', serif; font-size: 1.9rem; font-weight: 300; color: white; line-height: 1.3; margin-bottom: 0.75rem; }
.auth-hero h2 em { font-style: italic; color: #f0a868; }
.auth-hero p { font-size: 0.85rem; color: rgba(255,255,255,0.45); line-height: 1.6; }
.auth-foot { font-size: 0.7rem; color: rgba(255,255,255,0.25); position: relative; z-index: 1; }
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-box { width: 100%; max-width: 400px; }
.auth-title { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.auth-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.75rem; }
.auth-field { margin-bottom: 1rem; }
.auth-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-family: 'DM Mono', monospace; }
.auth-field input { width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.9rem; font-family: 'DM Sans', sans-serif; outline: none; }
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,31,91,0.1); }
.auth-btn { width: 100%; padding: 0.75rem; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.18s; font-family: 'DM Sans', sans-serif; }
.auth-btn:hover { background: var(--accent-dark); }
.auth-error { background: #fde8e6; border: 1px solid #f5c6c2; border-radius: 7px; padding: 0.6rem 0.85rem; font-size: 0.82rem; color: var(--danger); margin-bottom: 1rem; display: none; }

/* ── PRINT ── */
@media print {
  .topnav, .sidebar, .modal-footer, .modal-header .close-btn, .no-print { display: none !important; }
  .main-content { padding: 0; }
}

@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
