/* Admin panel styling. Plain CSS on purpose — no build step on the VPS. */

/* The same forest-green identity as the public marketing site's
   /assets/site.css (--primary #1f6b58 there too), so the panel and the
   site read as one product rather than two. Different variable names on
   purpose — this file already used --text/--card/--primary-hover before
   the site.css names existed, and renaming every rule that reads them
   would be a much bigger diff than a color needs. Every rule here reads a
   variable rather than a literal color, so this block is the one place
   the whole panel's palette lives. */
:root {
  --bg: #f5f7f6;
  --card: #ffffff;
  --text: #16211f;
  --muted: #66736f;
  --placeholder: #a8b2af;
  --border: #dfe5e2;
  --primary: #1f6b58;
  --primary-hover: #17513f;
  --danger: #b3261e;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 24px; padding: 14px 20px; flex-wrap: wrap; }
.brand { font-weight: 600; }
.brand small { color: var(--muted); font-weight: 400; }
.topbar nav { display: flex; gap: 4px; margin-right: auto; }
.topbar nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px;
  border-radius: 6px; font-weight: 500;
}
.topbar nav a:hover { background: var(--bg); color: var(--text); }
.topbar nav a.active { background: var(--primary); color: #fff; }
.who { color: var(--muted); font-size: 14px; }
.who a { color: var(--primary); }

main { padding-bottom: 60px; }

h1 { font-size: 24px; margin: 28px 0 18px; }
h2 { font-size: 17px; margin: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.pad { padding: 20px; }
.right { text-align: right; white-space: nowrap; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* Buttons */
.btn {
  display: inline-block; background: var(--primary); color: #fff; border: 0;
  padding: 9px 16px; border-radius: 6px; font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); }
.btn-plain {
  display: inline-block; color: var(--muted); text-decoration: none;
  padding: 9px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card); font-weight: 500; cursor: pointer;
}
.btn-plain:hover { color: var(--text); }
.btn-danger {
  background: var(--danger); color: #fff; border: 0; padding: 9px 16px;
  border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer;
}

/* The armed, "click again" state a data-confirm form's button goes into on
   its first click — see the shared script in _helpers.php. A ring rather
   than a color swap, so it reads clearly on both .btn-danger and .btn-plain. */
.btn-confirming {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* Dashboard hero — a quiet header band, not a hero image. The skyline reads
   as texture, not content, which is why it carries aria-hidden and stays
   under the card's own light shadow rather than fighting it. */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #eef4f1 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  margin: 28px 0 24px;
}
.dashboard-hero-content { position: relative; z-index: 1; padding: 26px 24px 8px; }
.dashboard-hero h1 { margin: 0 0 4px; }
.dashboard-hero-sub { margin: 0; color: var(--muted); font-size: 14px; }
.skyline {
  display: block;
  width: 100%;
  height: 110px;
  /* Both layers key off currentColor at different opacities, so the whole
     illustration is one palette value away from matching a new theme. */
  color: var(--muted);
}
.skyline-back  { fill: currentColor; opacity: .08; }
.skyline-front { fill: currentColor; opacity: .16; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.stat-label { display: block; color: var(--muted); font-size: 13px; }
.stat-value { display: block; font-size: 26px; font-weight: 600; margin-top: 6px; }

/* Panels + tables */
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 22px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f2f7f5; }
td a { color: var(--primary); text-decoration: none; font-weight: 500; }
td a + a { margin-left: 14px; }

/* Status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill-occupied { background: #e3f0ea; color: #17513f; }
.pill-vacant { background: #f5e3bf; color: #8a5a1f; }
.pill-maintenance { background: #e3e9e6; color: #4d5c56; }

/* Forms */
.form { padding: 22px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; background: var(--card); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary);
}
.field textarea { resize: vertical; }
/* Lighter than --muted so example text never reads as something already typed. */
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); opacity: 1; }
.field.checkbox label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.field.checkbox input { width: auto; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 0 0 110px; }
.row .field.grow { flex: 1 1 160px; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.subsection { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px 4px; margin: 18px 0; min-width: 0; }
.subsection legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.subsection .hint { margin-bottom: 14px; }
.input-pair { display: flex; gap: 6px; }
.input-pair input { flex: 1 1 auto; min-width: 0; }
.field .input-pair select { width: auto; flex: 0 0 auto; }
.schedule { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 14px; }
.schedule th, .schedule td { padding: 7px 8px; border-top: 1px solid var(--border); text-align: left; }
.schedule th { color: var(--muted); font-weight: 500; font-size: 13px; border-top: 0; }
.schedule .right { text-align: right; }

.filter { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.filter select { padding: 8px 11px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--card); }

/* Messages */
.flash { background: #e3f0ea; color: #17513f; padding: 12px 16px; border-radius: 6px; margin-top: 20px; }
.errors { background: #f8d9d5; color: #8a2f24; padding: 12px 16px; border-radius: 6px; margin: 20px 0; }
.errors ul { margin: 0; padding-left: 18px; }

.danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-color: #eab8b0; }
.danger p { margin: 4px 0 0; font-size: 14px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
.login-card h1 { margin: 0; font-size: 21px; }
.login-logo {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none;
}
.login-logo:hover { color: var(--primary); }
.login-logo svg { width: 28px; height: 28px; flex: 0 0 auto; }
.login-card p { margin: 6px 0 22px; font-size: 14px; }
.login-card label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.login-card input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; margin-bottom: 16px;
}
.login-card button { width: 100%; background: var(--primary); color: #fff; border: 0; padding: 10px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; }
.login-card .errors { margin-bottom: 18px; }

/* API tokens */
.token-value {
  background: #16211f; color: #e8f2ee; border-radius: 6px;
  padding: 14px 16px; margin: 12px 0;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* The token is one long unbroken string. Without these it either overflows
     the card or forces the page to scroll sideways on a phone — and this is
     the one value a user has to select and copy exactly. */
  word-break: break-all; white-space: pre-wrap; user-select: all;
}

/* A revoke button sits inside its own form, which would otherwise break the
   table row onto two lines. */
.inline { display: inline; margin: 0; }
.inline .btn-plain { color: var(--danger); }

/* Lease status pills. Derived from dates, so these are the three states a
   lease can be in, not user-set values. */
.pill-active   { background: #e3f0ea; color: #17513f; }
.pill-upcoming { background: #f5e3bf; color: #8a5a1f; }
.pill-ended    { background: #e3e9e6; color: #4d5c56; }

/* Balance pills. Also derived — charged minus paid — rather than a status
   anyone sets directly. */
.pill-current { background: #e3f0ea; color: #17513f; }
.pill-late    { background: #f8d9d5; color: #8a2f24; }

/* A multiple-select needs visible height; the browser default shows one row,
   which hides the fact that more than one tenant can be chosen. */
select[multiple] {
  padding: 6px; min-height: 96px; width: 100%;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
select[multiple] option { padding: 4px 6px; }

/* A qualifier beside a status pill — tenant names, or that occupancy is
   recorded by hand rather than from a lease. Deliberately quiet: it is
   context, not a warning. */
.tiny { font-size: 12px; display: inline-block; margin-left: 6px; }
