/* ==========================================================
   Home Executive Suite — sidebar layout
   Palette: deep protea green + warm sandstone + slate ink
   Type: Sora (display) / Public Sans (body)
   ========================================================== */
:root {
  --ink:        #1e2a26;
  --ink-soft:   #55645e;
  --surface:    #f6f5f0;
  --card:       #ffffff;
  --line:       #e2e0d6;
  --green:      #1f6f50;
  --green-deep: #14503a;
  --green-ink:  #0e3a2a;
  --gold:       #b98a1e;
  --red:        #b3402f;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(30, 42, 38, 0.08);
  --sidebar-w:  232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 15.5px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
}

h1, h2, h3, .brand { font-family: 'Sora', sans-serif; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .75rem; }
a  { color: var(--green); }
.muted { color: var(--ink-soft); font-size: .92em; }

/* ================= Sidebar ================= */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--green-deep), var(--green-ink));
  color: #fff; display: flex; flex-direction: column;
  padding: 1.1rem .8rem; z-index: 50;
}
.brand {
  color: #fff; text-decoration: none; font-weight: 700;
  display: flex; align-items: center; gap: .6rem;
  padding: .25rem .5rem 1rem; font-size: .98rem;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; border-radius: 8px;
  background: var(--gold); color: var(--green-deep);
  font-size: .82rem; font-weight: 700;
}
.brand-name { line-height: 1.2; }

.sidenav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidenav a {
  display: flex; align-items: center; gap: .7rem;
  color: #cfe0d7; text-decoration: none;
  padding: .55rem .7rem; border-radius: 8px;
  font-weight: 500; font-size: .93rem;
  border-left: 3px solid transparent;
}
.sidenav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidenav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidenav a.active {
  background: rgba(255,255,255,.12); color: #fff;
  border-left-color: var(--gold); font-weight: 600;
}

.side-user {
  border-top: 1px solid rgba(255,255,255,.15);
  padding: .8rem .6rem 0; font-size: .88rem;
}
.side-user-name { font-weight: 600; }
.side-user a { color: #cfe0d7; font-size: .84rem; }

/* ================= Shell / content ================= */
.shell { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1; max-width: 1040px; width: 100%; padding: 1.6rem 1.5rem 3rem; }
.content-plain { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.mobilebar { display: none; }

.footer {
  color: var(--ink-soft); font-size: .82rem;
  border-top: 1px solid var(--line); padding: 1rem 1.5rem;
}

/* ================= Components ================= */
.page-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

.pill { font-size: .78rem; font-weight: 600; padding: .2rem .65rem; border-radius: 99px; }
.pill-amber { background: #f5e7c6; color: #7a5a0e; }
.pill-green { background: #dcefe4; color: var(--green-deep); }
.pill-grey  { background: #e8e7e0; color: var(--ink-soft); }
.pill-red   { background: #f7e0db; color: #7c2317; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .9rem; margin-bottom: 1.5rem;
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); transition: border-color .15s;
}
.stat:hover { border-color: var(--green); }
.stat-num { display: block; font-family: 'Sora', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--green-deep); }
.stat-label { color: var(--ink-soft); font-size: .88rem; }
.stat-warn .stat-num { color: var(--red); }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid var(--line); padding: .5rem .6rem;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
}
.table td { padding: .6rem; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }

.btn {
  display: inline-block; padding: .55rem 1.05rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: .92rem; cursor: pointer;
  font-family: 'Public Sans', sans-serif;
}
.btn:hover { border-color: var(--green); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-danger { background: #fff; border-color: #e0b7ae; color: var(--red); }
.btn-sm { padding: .3rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=number], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .9rem; }
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem .4rem; margin: 0 0 1.25rem;
}
legend {
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: .92rem;
  color: var(--green-deep); padding: 0 .4rem;
}
.checkline { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; }
.checkline input { width: auto; margin-top: .25rem; }

/* ---- Auth screens ---- */
.auth-wrap { display: flex; justify-content: center; padding: 2.5rem 0; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 2rem 2rem 1.5rem; width: 100%; max-width: 460px;
}
.auth-brand { margin-bottom: 1rem; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 1rem; }
.auth-card h1 { margin-bottom: .25rem; }
.auth-alt { text-align: center; font-size: .9rem; color: var(--ink-soft); }

/* Wide onboarding card */
.auth-card.wide { max-width: 640px; }

/* ---- Flash ---- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; font-weight: 500; }
.flash-success { background: #e3efe7; color: var(--green-deep); border: 1px solid #bcd8c8; }
.flash-error   { background: #f7e4e0; color: #7c2317; border: 1px solid #e6bdb5; }
.flash-info    { background: #e8ecf5; color: #2c4a7c; border: 1px solid #c3cfe4; }

/* Invite link box */
.copybox {
  display: flex; gap: .5rem; align-items: center;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: 8px; padding: .6rem .8rem; font-size: .85rem;
  word-break: break-all;
}

/* ================= Mobile ================= */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .shell { margin-left: 0; }
  .mobilebar {
    display: flex; align-items: center; gap: .8rem;
    background: var(--green-deep); color: #fff; padding: .55rem .9rem;
    position: sticky; top: 0; z-index: 40;
  }
  .menu-toggle {
    background: none; border: 1px solid rgba(255,255,255,.35); color: #fff;
    font-size: 1.05rem; border-radius: 6px; padding: .15rem .55rem; cursor: pointer;
  }
  .mobile-title { font-family: 'Sora', sans-serif; font-weight: 600; font-size: .95rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 1.1rem 1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
