/* ============================================================
   Rodízio SP — sistema visual executivo
   Paleta ink / marfim / madeira (combina com a planta baixa).
   Tipografia editorial: Fraunces (títulos) + Inter (texto).
   ============================================================ */
:root {
  /* Identidade Addvalora: laranja (#ee7a00) + azul-marinho (#0f3a5b) */
  --ink: #0f3a5b;
  --ink-2: #15527f;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-3: #eaeef2;
  --border: #e1e6ec;
  --border-strong: #ccd4dd;
  --text: #16242f;
  --muted: #61707d;
  --muted-2: #93a0ab;
  --accent: #ee7a00;
  --accent-600: #cf6a00;
  --accent-50: #fdeede;
  --wood: #b98a59;
  --free: #2f9e6b; --free-bg: #e3efe5; --free-ink:#235b3f;
  --busy: #bd5238; --busy-bg: #f3e2da; --busy-ink:#7c3925;
  --mine: #15527f; --mine-bg: #e3edf5; --mine-ink:#0f3a5b;
  --warn: #b9791f; --warn-bg: #f6ecd6;
  --shadow-sm: 0 1px 2px rgba(24,22,18,.05), 0 1px 3px rgba(24,22,18,.06);
  --shadow: 0 4px 14px rgba(24,22,18,.07), 0 18px 40px rgba(24,22,18,.06);
  --radius: 13px;
  --radius-sm: 9px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.hidden { display: none !important; }

.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.icon { width: 18px; height: 18px; display: inline-block; flex: none; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 17px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--surface-3); color: var(--text); transition: .15s ease;
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-600); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--busy-bg); color: var(--busy-ink); }
.btn-danger:hover { background: #ecd2c7; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
label.field { display: block; margin-bottom: 15px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(238,122,0,.18); }
textarea { resize: vertical; min-height: 64px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--ink);
  background-image:
    radial-gradient(820px 480px at 88% -10%, rgba(238,122,0,.32) 0%, rgba(238,122,0,0) 55%),
    radial-gradient(900px 520px at 10% 8%, #1a4e78 0%, rgba(26,78,120,0) 60%),
    linear-gradient(160deg, #0f3a5b 0%, #0b2c46 100%);
}
.login-card {
  width: 100%; max-width: 430px; background: var(--surface);
  border-radius: 18px; padding: 38px 34px; box-shadow: 0 40px 90px rgba(0,0,0,.5);
}
.login-card .brand { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.login-card h1 { font-size: 23px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 4px 0 26px; }

/* marca Addvalora */
.logo { width: 46px; height: 46px; flex: none; }
.logo img, .logo svg { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-head { margin-bottom: 22px; }
.brand-logo { display: block; width: 100%; max-width: 240px; height: auto; }
.brand-sub { margin-top: 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }

/* ---------- Layout app ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff;
  padding: 0 22px; height: 64px; display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.topbar .logo { width: 38px; height: 38px; border-radius: 9px; font-size: 16px; }
.topbar .title { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.05; }
.topbar .title small { display: block; font-family: var(--sans); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #98a0aa; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: #d8dce1; }
.topbar .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.topbar .linkbtn { color: #cfd4da; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); padding: 8px 13px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.topbar .linkbtn:hover { background: rgba(255,255,255,.1); }

.nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 18px; display: flex; gap: 2px; overflow-x: auto; position: sticky; top: 64px; z-index: 20; }
.nav button { background: none; border: none; padding: 15px 15px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav button:hover { color: var(--text); }
.nav button.active { color: var(--accent); border-bottom-color: var(--accent); }

.main { flex: 1; padding: 26px 22px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------- Cards / blocos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.section-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h2 { font-size: 25px; }
.section-head .spacer { flex: 1; }
.sub-lead { color: var(--muted); margin: 2px 0 20px; font-size: 14px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-title { font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* date control */
.datectl { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; }
.datectl input[type=date] { border: none; box-shadow: none; width: auto; padding: 7px 8px; font-weight: 600; }
.datectl button { background: var(--surface-2); border: none; width: 34px; height: 34px; border-radius: 7px; cursor: pointer; font-size: 17px; color: var(--muted); }
.datectl button:hover { background: var(--surface-3); }

/* ---------- Planta do dia ---------- */
.map-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
.floormap-card { padding: 16px; overflow: hidden; background: var(--surface); }
.floormap { width: 100%; height: auto; display: block; user-select: none; border-radius: 8px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 14px; padding: 0 6px; }
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.seat { cursor: pointer; transition: .12s; } .seat:hover { opacity: .86; }
.seat-label { font-weight: 700; pointer-events: none; }
.room-block { cursor: pointer; } .room-block:hover { opacity: .9; }

/* lista de recursos */
.res-list { display: flex; flex-direction: column; gap: 8px; }
.res-item { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: .12s; }
.res-item .ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.res-item .ico .icon { width: 19px; height: 19px; }
.res-item .info { flex: 1; min-width: 0; }
.res-item .info b { display: block; font-size: 14px; font-weight: 650; }
.res-item .info small { color: var(--muted); font-size: 12.5px; }
.res-item.free .ico { background: var(--free-bg); color: var(--free-ink); }
.res-item.busy .ico { background: var(--busy-bg); color: var(--busy-ink); }
.res-item.mine { border-color: var(--mine); background: var(--mine-bg); }
.res-item.mine .ico { background: #fff; color: var(--mine-ink); }

.tag { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; letter-spacing: .02em; }
.tag-free { background: var(--free-bg); color: var(--free-ink); }
.tag-busy { background: var(--busy-bg); color: var(--busy-ink); }
.tag-mine { background: #fff; color: var(--mine-ink); border: 1px solid var(--mine); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-blocked { background: #e9e9eb; color: #5b6066; }
.res-item.blocked .ico { background: #e6e6e8; color: #6b7079; }

/* ---------- Salas / timeline ---------- */
.room-tabs { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.room-tab { padding: 10px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text); }
.room-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.now-banner { padding: 14px 18px; border-radius: var(--radius-sm); font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.now-banner.free { background: var(--free-bg); color: var(--free-ink); }
.now-banner.busy { background: var(--busy-bg); color: var(--busy-ink); }
.now-banner .icon { width: 20px; height: 20px; }

.meeting-list { display: flex; flex-direction: column; gap: 9px; }
.meeting { display: flex; gap: 13px; align-items: center; padding: 12px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.meeting .time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 104px; color: var(--ink); }
.meeting .who { color: var(--muted); font-size: 12.5px; }

/* ---------- Minhas reservas ---------- */
.booking-day { margin-bottom: 20px; }
.booking-day h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 9px; font-weight: 700; }

/* ---------- Tabelas (admin) ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 11px; border-bottom: 1.5px solid var(--border-strong); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.tbl td { padding: 10px 11px; border-bottom: 1px solid var(--surface-3); }
table.tbl tr:hover td { background: var(--surface-2); }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .v { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.stat .k { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* mini bar chart */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: 14px; }
.bars .bar { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .9; }
.bars .bar:hover { opacity: 1; }
.bars .bar span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-weight: 600; }
.bars-x { display: flex; gap: 5px; margin-top: 5px; }
.bars-x div { flex: 1; text-align: center; font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; }

/* admin subtabs */
.subnav { display: flex; gap: 7px; margin-bottom: 20px; flex-wrap: wrap; }
.subnav button { padding: 9px 15px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); }
.subnav button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(22,24,28,.55); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 450px; box-shadow: 0 40px 90px rgba(0,0,0,.4); }
.modal header { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal header h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.modal header .x { margin-left: auto; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal .body { padding: 22px; }
.modal .foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 12px 19px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); animation: pop .2s ease; max-width: 90vw; }
.toast.ok { background: #1c5e44; }
.toast.err { background: #8a3322; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; opacity: .4; margin: 0 auto 6px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 34px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (max-width: 880px) {
  .map-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar .title small { display: none; }
  .main { padding: 18px 14px 40px; }
  .section-head h2 { font-size: 22px; }
}
