:root {
  --bg: #f6f1ea; --card: #fffdf9; --ink: #2b2a28; --muted: #7a7168; --line: #e3d9cc;
  --accent: #9c5b3b; --accent-ink: #fff; --ok: #3f6b4a; --danger: #a33a2c; --soft: #efe5d8;
  --radius: 10px; font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); } .small { font-size: .85em; } .nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--ink); color: #f3ece4; flex-wrap: wrap; }
.top .brand { color: #f3ece4; font-weight: 700; letter-spacing: .02em; text-decoration: none; font-size: 1.1rem; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: #d8cfc4; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.top .logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.top .who { color: #bdb3a8; font-size: .9em; }
.top .link { color: #f3ece4; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.4rem; }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .top nav, .top .logout { display: none; width: 100%; }
  body.nav-open .top nav { display: flex; flex-direction: column; }
  body.nav-open .top .logout { display: flex; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wrap-row > * { flex: 0 1 auto; }
.form label, .wrap-row label { display: flex; flex-direction: column; gap: 4px; font-size: .9em; color: var(--muted); margin-bottom: 10px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.compact { padding: 12px 16px; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.small { padding: 6px 12px; font-size: .9em; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--danger); }
.flash { background: #e6efe6; border: 1px solid #c6d8c6; color: var(--ok); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { background: #f8e6e3; border: 1px solid #ebc4bd; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.tag { background: var(--soft); border-radius: 999px; padding: 3px 10px; font-size: .85em; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

.table-wrap { overflow-x: auto; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); font-size: .85em; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
tr.inactive td { opacity: .55; }
table.audit pre { white-space: pre-wrap; word-break: break-all; font-size: .8em; background: var(--soft); padding: 6px; border-radius: 6px; max-width: 520px; }

.hours { display: grid; gap: 6px; margin-bottom: 10px; }
.hours-row { display: grid; grid-template-columns: 100px 1fr 1fr auto; gap: 8px; align-items: center; max-width: 520px; }

.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login .card { text-align: left; }
.login label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--muted); font-size: .9em; }
.login .btn { width: 100%; }
.brand-big { font-size: 2.4rem; color: var(--accent); margin: 0; letter-spacing: .02em; }

/* ---------- calendario ---------- */
.inline { display: inline; margin: 0; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
label.block { display: flex; flex-direction: column; gap: 4px; font-size: .9em; color: var(--muted); margin-bottom: 10px; }
.warn { background: #fbf2dc; border: 1px solid #ecd9a6; color: #6b5115; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; display: grid; gap: 6px; }
.tag.extra, .is-extra { --x: #c9822b; }
.tag.extra { background: #c9822b; color: #fff; }
.pre { white-space: pre-wrap; }
.appt-row.is-extra { border-left: 4px solid #c9822b; }
.cal { --gut: 52px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.cal-head, .cal-body { display: grid; grid-template-columns: var(--gut) repeat(var(--cols), minmax(150px, 1fr)); min-width: calc(var(--gut) + var(--cols) * 150px); }
.cal-head { position: sticky; top: 0; background: var(--soft); border-bottom: 1px solid var(--line); z-index: 3; }
.cal-colhead { padding: 8px 10px; border-left: 1px solid var(--line); display: flex; flex-direction: column; line-height: 1.2; }
.cal-colhead span { font-size: .78em; color: var(--muted); }
.cal-body { position: relative; }
.cal-gutter { position: relative; }
.cal-hour { position: absolute; left: 0; right: 0; font-size: .75em; color: var(--muted); padding: 0 6px; transform: translateY(-1px); border-top: 1px solid var(--line); }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-slot { position: absolute; left: 0; right: 0; border-top: 1px dashed #efe7dc; display: block; }
a.cal-slot:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cal-block { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: .8em; line-height: 1.25; overflow: hidden; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--c, #9c5b3b) 16%, #fff); border-left: 4px solid var(--c, #9c5b3b); z-index: 2; display: flex; flex-direction: column; }
.cal-block span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block.is-extra { box-shadow: inset 0 0 0 2px #c9822b; }
.cal-block.busy { background: repeating-linear-gradient(45deg, #eee7de, #eee7de 6px, #f6f1ea 6px, #f6f1ea 12px); border-left-color: #b9b0a5; color: var(--muted); }
.cal-now { position: absolute; left: var(--gut); right: 0; border-top: 2px solid #c0392b; z-index: 4; pointer-events: none; }
