:root {
  --bg: #f3f1ec;
  --bg-elev: #fffcf7;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #c2410c;
  --accent-ink: #fff7ed;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --err: #991b1b;
  --err-bg: #fee2e2;
  --nav: #1c1917;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(28 25 23 / 6%);
  --font: "Outfit", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fed7aa55, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #e7e5e488, transparent 55%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.app-shell { max-width: 960px; margin: 0 auto; padding: 0 1rem 5.5rem; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem;
}
.brand {
  font-weight: 700; letter-spacing: -.03em; font-size: 1.25rem;
  color: var(--ink); text-decoration: none;
}
.brand span { color: var(--accent); }
.user-chip { font-size: .85rem; color: var(--muted); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--nav); color: #e7e5e4;
  padding: .45rem .25rem calc(.45rem + env(safe-area-inset-bottom));
  border-top: 1px solid #292524;
}
.bottom-nav a {
  color: #a8a29e; text-decoration: none; text-align: center;
  font-size: .68rem; font-weight: 600; padding: .35rem .15rem;
  border-radius: 8px;
}
.bottom-nav a strong { display: block; font-size: 1.05rem; font-weight: 700; margin-bottom: .1rem; color: #fafaf9; }
.bottom-nav a.active { color: #fdba74; background: #292524; }
.bottom-nav a.active strong { color: #fdba74; }

h1 { font-size: 1.55rem; letter-spacing: -.03em; margin: 1.1rem 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.muted { color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }

.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  margin-bottom: .75rem;
}
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: #d6d3d1; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: .75rem 0 1rem;
}
.stat {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem .7rem; text-align: center;
}
.stat .n { font-size: 1.45rem; font-weight: 700; letter-spacing: -.04em; font-family: var(--mono); }
.stat .l { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: .65rem 1rem; font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-decoration: none; background: var(--ink); color: #fff;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }

.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .8rem; font: inherit; background: #fff; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-hint { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.flash {
  padding: .75rem 1rem; border-radius: 10px; margin: .75rem 0; font-size: .92rem;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--err-bg); color: var(--err); }

.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-available { background: #dcfce7; color: #166534; }
.badge-reserved { background: #fef3c7; color: #92400e; }
.badge-sold { background: #e7e5e4; color: #44403c; }
.badge-open { background: #ffedd5; color: #9a3412; }
.badge-cancelled, .badge-expired { background: #e7e5e4; color: #57534e; }

.item-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: .75rem; align-items: center;
}
.thumb {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
  background: #e7e5e4; border: 1px solid var(--line);
}
.thumb-ph {
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: var(--muted); font-weight: 600;
}
.item-meta { font-size: .85rem; color: var(--muted); }
.box-num {
  font-family: var(--mono); font-weight: 700; font-size: 1.4rem; letter-spacing: -.04em;
}

.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem;
}
.photo-grid figure {
  margin: 0; position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #e7e5e4; aspect-ratio: 1;
}
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid form { position: absolute; top: .35rem; right: .35rem; }

.checklist {
  max-height: 320px; overflow: auto; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.checklist label {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .65rem .75rem; border-bottom: 1px solid var(--line);
  font-size: .9rem; cursor: pointer;
}
.checklist label:last-child { border-bottom: 0; }
.checklist input { margin-top: .2rem; }

.filters {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .85rem;
}
.filters input, .filters select {
  border: 1px solid var(--line); border-radius: 999px; padding: .55rem .85rem;
  font: inherit; background: #fff;
}
.filters input { flex: 1; min-width: 140px; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    linear-gradient(160deg, #1c1917 0%, #292524 45%, #7c2d12 120%);
}
.auth-card {
  width: min(420px, 100%); background: var(--bg-elev);
  border-radius: 18px; padding: 1.5rem; box-shadow: 0 20px 50px rgb(0 0 0 / 35%);
}
.auth-card .brand { font-size: 1.8rem; }
.auth-card h1 { margin-top: .35rem; }

.note {
  border-left: 3px solid var(--accent); padding: .55rem .75rem; margin-bottom: .55rem;
  background: #fff7ed; border-radius: 0 10px 10px 0;
}
.note time { display: block; font-size: .72rem; color: var(--muted); margin-bottom: .2rem; }

.table-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.alert-row { border-left: 3px solid var(--accent); }

.empty {
  text-align: center; padding: 2rem 1rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* Master panel */
.master-body { background:
  radial-gradient(1000px 480px at 0% -10%, #1c191722, transparent 55%),
  radial-gradient(800px 400px at 100% 0%, #c2410c18, transparent 50%),
  var(--bg);
}
.master-shell { padding-bottom: 2rem; }
.master-badge {
  font-style: normal; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); margin-left: .35rem;
  vertical-align: middle;
}
.row-between {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
}
.mono { font-family: var(--mono); font-size: .85em; }
.pill {
  display: inline-block; margin-left: .35rem;
  padding: .12rem .45rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.pill-master { background: #1c1917; color: #fdba74; }
.inline-reset { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }

/* Tom Select — alinhar ao visual Box */
.ts-wrapper.single .ts-control {
  border: 1px solid var(--line); border-radius: 10px;
  padding: .55rem .7rem; min-height: 46px;
  background: #fff; font: inherit; box-shadow: none;
}
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.focus .ts-control {
  border-color: #d6d3d1;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ts-dropdown {
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgb(28 25 23 / 12%);
  font: inherit; z-index: 50;
}
.ts-dropdown .option { padding: .55rem .75rem; }
.ts-dropdown .active { background: #fff7ed; color: var(--ink); }
.ts-dropdown .no-results { padding: .65rem .75rem; color: var(--muted); }
.ts-control input { font: inherit !important; }

.section-loc {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 1.25rem 0 .4rem; font-weight: 700;
}

