/* ========================================
   IGNITE BUSINESS — Portal & Admin UI (bold)
   ======================================== */

body { background: var(--bone); }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 264px 1fr;
}

/* ---- Sidebar ---- */
.app-aside {
  background: var(--ink);
  color: var(--cream);
  padding: 1.75rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  border-right: 3px solid var(--flame);
}
.app-aside .brand {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0.6rem 1.75rem;
}
.app-aside .brand img { height: 30px; }
.app-aside nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.app-aside nav a {
  position: relative;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius);
  color: rgba(250,248,244,0.72);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.app-aside nav a:hover { background: rgba(255,255,255,0.07); color: var(--cream); }
.app-aside nav a.active { background: rgba(232,93,4,0.16); color: var(--glow); }
.app-aside nav a.active::before {
  content: ""; position: absolute; left: -1.1rem; top: 0.55rem; bottom: 0.55rem;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--flame);
}
.app-aside nav a svg { width: 19px; height: 19px; stroke-width: 2.25; flex-shrink: 0; }
.app-aside .who {
  padding: 0.9rem 0.6rem 0.3rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8125rem;
  color: rgba(250,248,244,0.62);
}
.app-aside .who strong { color: var(--cream); display: block; font-weight: 700; font-size: 0.9rem; }
.app-aside .who button {
  margin-top: 0.7rem; font-size: 0.8125rem; font-weight: 600;
  color: var(--ember); background: none; border: 0; cursor: pointer; padding: 0;
}

/* ---- Main column ---- */
.app-main {
  /* Pin to the second grid track so content sits in the right place from the
     first paint — even before the sidebar is injected. Prevents the layout
     "snap" (content shifting right) once auth resolves. */
  grid-column: 2;
  padding: clamp(1.5rem, 3vw, 2.75rem);
  background: var(--bone);
  min-width: 0;
}

/* Skeleton sidebar shown for the split-second before the real nav is mounted,
   so column 1 is never an empty flash. */
.app-aside--skeleton nav .sk {
  height: 13px;
  margin: 0.5rem 0.85rem;
  border-radius: 6px;
  background: rgba(250, 248, 244, 0.08);
}
.app-aside--skeleton nav .sk:nth-child(odd) { width: 72%; }
.app-aside--skeleton nav .sk:nth-child(even) { width: 58%; }
.app-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.app-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.app-header .sub { color: var(--graphite); margin-top: 0.45rem; font-weight: 500; font-size: 1.0625rem; }

/* ---- Cards ---- */
.app-card {
  background: var(--paper);
  border: 1.5px solid var(--ash);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 2.5vw, 2rem);
  box-shadow: 0 10px 28px -16px rgba(10,10,10,0.18);
}
.app-card + .app-card { margin-top: 1.5rem; }
.app-card > h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--bone);
}
.app-card > h2 + .help { margin-top: 0.75rem; }
.app-card .help { color: var(--graphite); font-size: 0.975rem; margin-bottom: 1.5rem; font-weight: 500; }

/* ---- Key/value grid ---- */
.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 2rem; font-size: 1rem;
}
.kv-grid .label {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--stone); font-weight: 700; margin-bottom: 0.2rem;
}
.kv-grid .value { color: var(--ink); font-weight: 600; }
.kv-grid .value.empty, .kv-grid .value .empty { color: var(--stone); font-style: italic; font-weight: 400; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.3rem; }
.field label { font-size: 0.85rem; font-weight: 700; color: var(--charcoal); letter-spacing: 0.01em; }
/* Style EVERY text-like control (incl. inputs with no explicit type=, which is most of them). */
.field input:not([type=checkbox]):not([type=radio]):not([type=file]),
.field textarea, .field select {
  width: 100%; box-sizing: border-box; font: inherit; padding: 0.72rem 0.9rem;
  border: 1.5px solid var(--ash); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); font-size: 1rem; font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--stone); font-weight: 400; }
.field input:hover:not(:focus), .field textarea:hover:not(:focus), .field select:hover:not(:focus) { border-color: var(--graphite); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 0; border-color: var(--flame); box-shadow: 0 0 0 3px rgba(232,93,4,0.14);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
/* Native select chevron */
.field select {
  -webkit-appearance: none; appearance: none; padding-right: 2.4rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.95rem center;
}
.field .hint { color: var(--stone); font-size: 0.8125rem; font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1.1rem; }
/* Checkbox / radio labels read as a row, not a stacked block */
.field label:has(> input[type=checkbox]), .field label:has(> input[type=radio]) {
  flex-direction: row; align-items: center; gap: 0.6rem; font-weight: 500; cursor: pointer;
}
.field input[type=checkbox], .field input[type=radio] { width: 1.1rem; height: 1.1rem; accent-color: var(--flame); flex: 0 0 auto; }

.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-group label {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border-radius: 999px;
  border: 1.5px solid var(--ash); background: var(--cream);
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.chip-group input[type=checkbox] { display: none; }
.chip-group label:has(input:checked) { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* ---- Flash messages ---- */
.flash {
  padding: 0.85rem 1.15rem; border-radius: var(--radius);
  font-size: 0.975rem; font-weight: 600; margin-bottom: 1.4rem;
  border-left: 4px solid;
}
.flash.success { background: #ECFDF5; color: #065F46; border-color: #10B981; }
.flash.error   { background: #FEF2F2; color: #991B1B; border-color: #EF4444; }
.flash.info    { background: #EFF6FF; color: #1E40AF; border-color: #3B82F6; }

.empty {
  padding: 2.75rem 1rem; text-align: center; color: var(--stone);
  font-family: var(--font-serif); font-style: italic; font-size: 1.0625rem;
}

/* ---- Toolbar (search row above tables) ---- */
.data-toolbar {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.data-toolbar input[type=search] {
  flex: 1; min-width: 200px; font: inherit; font-size: 1rem;
  padding: 0.7rem 0.95rem; border: 1.5px solid var(--ash);
  border-radius: var(--radius); background: var(--paper);
}
.data-toolbar input[type=search]:focus { outline: 0; border-color: var(--flame); box-shadow: 0 0 0 3px rgba(232,93,4,0.14); }
.count-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--ink); color: var(--cream);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.35rem 0.75rem; border-radius: 999px;
}

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1.5px solid var(--ash); border-radius: var(--radius-lg); }
.app-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
/* On phones, any data table (wrapped or not) scrolls sideways instead of squishing. */
@media (max-width: 760px) {
  .app-card > .app-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}
.app-table th, .app-table td { padding: 0.85rem 1rem; text-align: left; vertical-align: middle; }
.app-table thead th {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); font-weight: 700; background: var(--bone);
  border-bottom: 2px solid var(--ash);
}
.app-table tbody td { border-bottom: 1px solid var(--bone); }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover td { background: var(--cream); }
.app-table td strong { font-weight: 700; }
.app-table .status, .pill {
  display: inline-block; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0.65rem; border-radius: 999px; font-weight: 800;
}
.app-table .status.active, .pill.green { background: #D1FAE5; color: #065F46; }
.app-table .status.pending, .pill.amber { background: #FEF3C7; color: #92400E; }
.app-table .status.paused, .pill.grey { background: #E5E7EB; color: #374151; }
.app-table .status.cancelled, .pill.red { background: #FEE2E2; color: #991B1B; }
.pill.flame { background: rgba(232,93,4,0.12); color: var(--flame-deep); }

/* ---- Reveal box (temp passwords etc.) ---- */
.reveal-box {
  margin-top: 1.1rem; padding: 1.1rem 1.3rem;
  background: var(--bone); border: 1.5px dashed var(--ash); border-radius: var(--radius-lg);
}
.reveal-box .label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite); font-weight: 700; }
.reveal-box .code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 800; font-size: 1.2rem; letter-spacing: 0.03em; margin-top: 0.3rem; color: var(--ink);
}

/* ---- Slide-over drawer (detail/edit panes) ---- */
.drawer {
  position: fixed; right: 1.25rem; bottom: 1.25rem; top: 1.25rem;
  width: min(560px, 95vw); overflow: auto; z-index: 60;
  background: var(--paper); border: 1.5px solid var(--ash); border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 2.5vw, 2rem);
  box-shadow: 0 40px 90px -30px rgba(10,10,10,0.4);
}
.drawer-close {
  position: absolute; top: 0.85rem; right: 0.95rem;
  width: 2rem; height: 2rem; border-radius: 999px; background: var(--bone);
  font-size: 1.35rem; line-height: 1; color: var(--graphite); cursor: pointer;
}
.drawer-close:hover { background: var(--ash); }

/* ---- Auth pages ---- */
.auth-page {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(ellipse 60% 50% at 85% 100%, rgba(232,93,4,0.14), transparent 60%),
    radial-gradient(ellipse 50% 40% at 15% 0%, rgba(244,140,6,0.09), transparent 60%),
    var(--bone);
}
.auth-card {
  width: 100%; max-width: 460px; background: var(--paper);
  border: 1.5px solid var(--ash); border-radius: var(--radius-lg);
  padding: 2.5rem; box-shadow: 0 40px 80px -36px rgba(10,10,10,0.28);
}
.auth-card .brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.4rem; }
.auth-card .brand img { height: 36px; }
.auth-card h1 { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
.auth-card .lede { color: var(--graphite); font-size: 0.975rem; margin-bottom: 1.6rem; font-weight: 500; }

/* ---- Logo upload ---- */
.logo-uploader { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.logo-preview {
  width: 124px; height: 124px; border: 2px dashed var(--ash); border-radius: var(--radius-lg);
  background: var(--cream); display: grid; place-items: center; overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 0.5rem; }
.logo-preview .empty { font-family: var(--font-serif); font-style: italic; color: var(--stone); font-size: 0.875rem; padding: 0; }

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-main { grid-column: 1; }
  .app-aside {
    position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center;
    padding: 0.75rem 1rem; border-right: 0; border-bottom: 3px solid var(--flame);
  }
  .app-aside .brand { padding: 0; flex-shrink: 0; }
  .app-aside nav { flex-direction: row; gap: 0.15rem; overflow-x: auto; }
  .app-aside nav a { padding: 0.5rem 0.7rem; font-size: 0.875rem; white-space: nowrap; }
  .app-aside nav a.active::before { display: none; }
  .app-aside nav a span { display: none; }
  .app-aside .who { border: 0; padding: 0 0 0 0.5rem; font-size: 0.75rem; margin-left: auto; }
  .app-aside .who strong { display: none; }
  .drawer { right: 0; left: 0; bottom: 0; top: 10vh; width: auto; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}
