/* Property Plus admin — brand tokens from the design system
   (charcoal ink, gold accent, green for success, warm glass canvas). */
:root {
  --ink-1: #14151A;
  --ink-2: #4B4E56;
  --ink-3: #9B9FA6;
  --ink-4: #C7C9CD;
  --dark-solid: rgba(20, 23, 30, 0.92);
  --gold-300: #E9C382;
  --gold-500: #B8863E;
  --gold-700: #8A6B1F;
  --gold-fill: rgba(233, 169, 58, 0.18);
  --green-500: #3FA66B;
  --green-700: #2E7D4F;
  --green-fill: rgba(63, 166, 107, 0.14);
  --amber: rgba(217, 139, 43, 0.9);
  --gray-strong: rgba(138, 143, 152, 0.9);
  --danger: #C0504D;
  --danger-border: #E8B4B4;
  --line-1: #E8E5DC;
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-bg-strong: rgba(255, 255, 255, 0.76);
  --glass-border: rgba(255, 255, 255, 0.7);
  --radius-card: 20px;
  --radius-input: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 24px rgba(20, 20, 30, 0.07);
  --shadow-float: 0 12px 30px rgba(20, 20, 30, 0.22);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  color: var(--ink-1);
  background: linear-gradient(165deg, #E3ECF7 0%, #EEECE6 45%, #F5F3ED 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--gold-500); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 800; }

/* ── Shell ───────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(26,29,36,.98), rgba(15,16,21,.98));
  border-inline-end: 1px solid rgba(255,255,255,.08);
  box-shadow: 12px 0 30px rgba(20,20,30,.12);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-300);
}
.brand-name { font-weight: 800; font-size: 15px; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; }

.nav-group-label {
  font-size: 10px; font-weight: 800; color: rgba(255,255,255,0.38);
  padding: 14px 12px 6px; letter-spacing: .6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 11px;
  color: rgba(255,255,255,0.72); font-size: 13.5px; font-weight: 700;
  border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active {
  background: rgba(233,195,130,0.14);
  border-color: rgba(233,195,130,0.3);
  color: var(--gold-300);
}
.nav-link .count {
  margin-inline-start: auto; font-size: 11px; font-weight: 800;
  background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: var(--radius-pill);
}

.main { flex: 1; min-width: 0; padding: 32px 36px 72px; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; letter-spacing: -.2px; }
.topbar .spacer { flex: 1; }
.who { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

/* ── Surfaces ────────────────────────────────────── */
.card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(160%);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 14px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat {
  background: linear-gradient(135deg, var(--glass-bg-strong), rgba(255,255,255,.48)); border: 1px solid var(--glass-border);
  border-radius: var(--radius-card); padding: 18px 20px; box-shadow: var(--shadow-card);
}
.stat .label { font-size: 11px; font-weight: 800; color: var(--ink-3); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 800; }
.stat .value.gold { color: var(--gold-500); }
.stat .value.green { color: var(--green-500); }

/* ── Tables ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: start; font-size: 11px; font-weight: 800; color: var(--ink-3);
  padding: 0 12px 10px; white-space: nowrap;
}
tbody td { padding: 12px; border-top: 1px solid var(--line-1); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.4); }
td.name { font-weight: 800; }
td.muted { color: var(--ink-3); }
td.actions { text-align: end; white-space: nowrap; }

.thumb {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background-size: cover; background-position: center;
}

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 800; white-space: nowrap;
}
.badge.full { background: rgba(63,166,107,0.9); color: #fff; }
.badge.semi { background: var(--amber); color: #fff; }
.badge.core { background: var(--gray-strong); color: #fff; }
.badge.gold { background: var(--gold-fill); color: var(--gold-700); }
.badge.green { background: var(--green-fill); color: var(--green-700); }
.badge.muted { background: rgba(20,20,30,0.08); color: var(--ink-2); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: var(--radius-input);
  font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; transition: filter .15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn-primary { background: var(--dark-solid); color: #fff; box-shadow: var(--shadow-float); }
.btn-gold { background: var(--gold-500); color: #fff; }
.btn-glass { background: rgba(255,255,255,0.7); border-color: var(--line-1); color: var(--ink-1); }
.btn-danger { background: transparent; border-color: var(--danger-border); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Forms ───────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 11.5px; font-weight: 800; color: var(--ink-3); }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--ink-1);
  height: 44px; padding: 0 13px;
  border: 1px solid var(--line-1); border-radius: var(--radius-input);
  background: rgba(255,255,255,0.75); outline: none;
}
textarea { height: auto; min-height: 86px; padding: 11px 13px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-500); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 12px; font-size: 13px; font-weight: 800;
}
.repeater-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeater-row input, .repeater-row select { flex: 1; min-width: 0; }

/* ── Login ───────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo {
  width: 60px; height: 60px; border-radius: 17px; background: var(--dark-solid);
  display: flex; align-items: center; justify-content: center; color: var(--gold-300);
  margin-bottom: 20px;
}
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card .sub { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-bottom: 20px; line-height: 1.6; }

.alert { padding: 11px 14px; border-radius: 12px; font-size: 12.5px; font-weight: 700; margin-bottom: 14px; line-height: 1.6; }
.alert.error { background: rgba(192,80,77,0.1); color: var(--danger); }
.alert.info { background: var(--gold-fill); color: var(--gold-700); }
.alert.success { background: var(--green-fill); color: var(--green-700); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); font-size: 13.5px; }

@media (max-width: 820px) {
  .sidebar { width: 66px; padding: 18px 8px; }
  .brand-text, .nav-link .label, .nav-group-label, .nav-link .count { display: none; }
  .nav-link { justify-content: center; }
  .main { padding: 20px 16px 50px; }
}

/* Aqari v3: compact, touch-friendly admin mode keeps the same hierarchy on
   phones without reducing data tables to unreadable columns. */
@media (max-width: 560px) {
  .sidebar { position: fixed; z-index: 10; inset-block-end: 0; inset-inline: 0; width: auto; height: 64px; padding: 7px 10px; flex-direction: row; align-items: center; overflow: hidden; }
  .brand, .nav-group-label, .nav-link:nth-of-type(n+6), .sidebar > div[style] { display: none; }
  .nav-link { flex: 1; height: 50px; padding: 8px; }
  .nav-link .label { display: block; font-size: 10px; }
  .main { padding: 20px 14px 86px; }
  .topbar h1 { font-size: 20px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .card { padding: 15px; border-radius: 18px; }
}
/* A real map picker; isolated stacking keeps Leaflet below the application chrome. */
.project-location-map { height: 380px; width: 100%; margin-top: 18px; border-radius: 16px; isolation: isolate; background: #e9eee9; }
