/* Dhhaarma Spa admin. Brand: forest #2E6B3F, deep #1F4D2C, ground #F4F6F1, ink #17251C,
   muted #5B6B60, sage #E4EEE1, amber #7A4612 / #F6EBDD, danger #8E2F24. */
:root {
  --forest: #2E6B3F;
  --deep: #1F4D2C;
  --ground: #F4F6F1;
  --ink: #17251C;
  --muted: #5B6B60;
  --sage: #E4EEE1;
  --amber: #7A4612;
  --amber-bg: #F6EBDD;
  --danger: #8E2F24;
  --danger-bg: #F6E3E0;
  --line: #D9E2D5;
  --card: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 37, 28, .06), 0 4px 16px rgba(23, 37, 28, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--deep); color: #fff; padding: 20px 14px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; background: #fff; object-fit: contain; padding: 3px; }
.brand small { display: block; font-weight: 500; opacity: .7; font-size: .75rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: #E9F1E6; padding: 9px 12px; border-radius: 10px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.on { background: var(--forest); color: #fff; }
.side .who { margin-top: auto; font-size: .85rem; opacity: .9; padding: 0 8px; }
.side .who form, .topbar .nav form { margin-top: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.topbar { display: none; }
.main { padding: 26px 30px 60px; min-width: 0; max-width: 1280px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* Messages */
#flash { position: sticky; top: 0; z-index: 20; }
#flash:empty { display: none; }
.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; box-shadow: var(--shadow); }
.alert-ok { background: var(--sage); color: var(--deep); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--amber-bg); color: var(--amber); box-shadow: none; }

/* Cards and grids */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid > .card { margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; color: var(--ink); display: block; }
a.stat:hover { text-decoration: none; outline: 2px solid var(--sage); }
.stat b { display: block; font-size: 1.7rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn b { color: var(--amber); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #FAFBF8; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: .83rem; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.thumb { width: 56px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--sage); display: block; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sage); color: var(--deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; object-fit: cover; }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--sage); color: var(--deep); white-space: nowrap; }
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-confirmed { background: var(--forest); color: #fff; }
.pill-completed { background: var(--sage); color: var(--deep); }
.pill-cancelled { background: var(--danger-bg); color: var(--danger); }
.pill-off { background: #ECEEEA; color: var(--muted); }
.pill-gold { background: #F3E6C4; color: #6B4E0E; }
.pill-platinum { background: #E3E7EA; color: #33414C; }
.pill-ok { background: var(--sage); color: var(--deep); }

/* Forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 3px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; color: var(--ink); min-height: 42px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(46, 107, 63, .35); border-color: var(--forest); }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--forest); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.row { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.preview { max-width: 240px; max-height: 160px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 8px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input[type=password] { width: auto; flex: 1; min-width: 140px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 9px 16px; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--forest); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--deep); text-decoration: none; }
.btn-light { background: var(--sage); color: var(--deep); }
.btn-light:hover { background: #D3E3CE; }
.btn-amber { background: var(--amber-bg); color: var(--amber); }
.btn-amber:hover { background: #EEDCC4; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #EFCFCA; }
.btn-sm { padding: 5px 11px; min-height: 32px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.htmx-request .btn { opacity: .6; }

/* Slots */
.slot { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot .time { font-weight: 700; }
.slot .time small { display: block; color: var(--muted); font-weight: 500; }
.slot.past { opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); font-size: .85rem; color: var(--ink); }
a.chip:hover { text-decoration: none; border-color: var(--forest); }
.slotpick { display: flex; flex-wrap: wrap; gap: 8px; }
.slotpick label { margin: 0; position: relative; }
.slotpick input { position: absolute; opacity: 0; pointer-events: none; }
.slotpick span { display: inline-block; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; }
.slotpick input:checked + span { background: var(--forest); color: #fff; border-color: var(--forest); }
.slotpick input:disabled + span { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.slotpick input:focus-visible + span { outline: 2px solid var(--forest); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week a { background: var(--ground); border-radius: 10px; padding: 10px 6px; text-align: center; color: var(--ink); }
.week a:hover { text-decoration: none; outline: 2px solid var(--sage); }
.week a b { display: block; font-size: 1.3rem; }
.week a small { color: var(--muted); display: block; }

/* Totals */
.totals { width: auto; margin-left: auto; }
.totals td { border: 0; padding: 4px 0 4px 24px; }
.totals tr.final td { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--line); padding-top: 8px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .logo { width: 84px; height: 84px; display: block; margin: 0 auto 10px; object-fit: contain; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login p.muted { text-align: center; margin-bottom: 20px; }
.login .btn { width: 100%; }

/* Phone width */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; background: var(--deep); color: #fff;
    padding: 10px 16px; position: sticky; top: 0; z-index: 30;
  }
  .topbar details { position: relative; }
  .topbar summary { list-style: none; cursor: pointer; padding: 8px 14px; border-radius: 10px; background: rgba(255, 255, 255, .12); font-weight: 600; }
  .topbar summary::-webkit-details-marker { display: none; }
  .topbar .nav { position: absolute; right: 0; top: 48px; background: var(--deep); padding: 10px; border-radius: 12px; min-width: 230px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
  .topbar .nav .who { color: #E9F1E6; font-size: .85rem; padding: 8px 12px 2px; border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 6px; }
  .main { padding: 16px 16px 48px; }
  #flash { top: 60px; }
  .grid-2, .grid-3, .grid-wide { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h1 { font-size: 1.25rem; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 5px 14px 5px 118px; position: relative; text-align: left; min-height: 30px; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 14px; top: 7px; width: 96px; color: var(--muted); font-size: .8rem; font-weight: 600; }
  table.stack td[data-label=""] { padding-left: 14px; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td.right { text-align: left; }
  table.stack td select { max-width: 100%; }
  .slot { grid-template-columns: 74px 1fr; padding: 10px 14px; }
  .totals { width: 100%; }
  .filters .field { min-width: 130px; }
}

/* Sub-items under Settings in the menu */
.nav a.sub { padding-left: 26px; font-size: .92rem; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: 10px; background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.tabs a.on { background: var(--forest); color: #fff; }
.tabs a:hover { text-decoration: none; }

/* Role editor */
.areas { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 18px; }
.area { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.area header { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.area header h3 { margin: 0; }
.perm { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; padding: 6px 0; align-items: start; }
.perm input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--forest); }
.perm code { font-size: .82rem; color: var(--deep); background: var(--sage); padding: 1px 6px; border-radius: 6px; }
.perm .hint { grid-column: 2; margin: 0; }
.perm.off { opacity: .55; }
.badge-lock { background: var(--amber-bg); color: var(--amber); }
.reason { font-size: .78rem; color: var(--muted); display: block; margin-top: 2px; }

/* Matrix */
.matrix-wrap { overflow-x: auto; }
table.matrix th, table.matrix td { text-align: center; padding: 6px 8px; white-space: nowrap; }
table.matrix td:first-child, table.matrix th:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.matrix tr.area-row td { background: var(--ground); font-weight: 700; text-align: left; }
.yes { color: var(--forest); font-weight: 700; }
.no { color: #C4CCC2; }
.matrix-one { display: none; }
@media (max-width: 860px) {
  .matrix-full { display: none; }
  .matrix-one { display: block; }
}
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
