:root {
  --red: #B5202E;
  --red-dark: #951A26;
  --red-tint: #FBE9EA;
  --ink: #2A2A2C;
  --body: #46464A;
  --muted: #5F5F63;
  --ground: #F4F4F5;
  --line: #E4E4E7;
  --line-soft: #EFEFF1;
  --amber: #8A5A00;
  --amber-tint: #FDF1D8;
  --green: #1D6B43;
  --green-tint: #E2F0E7;
  --radius: 14px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); font-size: 14px; }
[hidden] { display: none !important; }
a { color: var(--red); }
h1, h2, h3 { font-family: Sora, system-ui, sans-serif; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1em; margin: 0; font-weight: 600; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-family: Sora, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: .04em; }
.brand small { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.brand-mark { width: 22px; height: 22px; border: 6px solid var(--red); border-right: 0; position: relative; }
.brand-mark::after { content: ""; position: absolute; left: -6px; right: 0; bottom: -12px; height: 4px; background: #5A5A5A; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: 600 14px 'Plus Jakarta Sans', sans-serif; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--red); border-color: #F0C4C8; }
.btn-danger:hover { background: var(--red-tint); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; font-size: 24px; cursor: pointer; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 24px; margin-top: 8px; }
.login-card p { margin: 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--body); }
label .hint { font-weight: 500; color: var(--muted); font-size: 12px; }
input, select, textarea { font: 500 14px 'Plus Jakarta Sans', sans-serif; color: var(--ink); border: 1px solid #D9D9DD; border-radius: 10px; padding: 9px 12px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: var(--red); }
textarea { resize: vertical; min-height: 80px; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.file-current { font-weight: 500; font-size: 12px; display: flex; gap: 10px; align-items: center; }

/* Layout */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 220px; max-width: 260px; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.sidebar nav a:hover { background: var(--line-soft); }
.sidebar nav a.active { background: var(--red-tint); color: var(--red); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.badge { background: var(--red); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 3vw, 40px); display: flex; flex-direction: column; gap: 20px; outline: none; }
@media (max-width: 760px) {
  .sidebar { max-width: none; flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; }
.crumb { background: none; border: 0; color: var(--red); font: 600 13px 'Plus Jakarta Sans', sans-serif; cursor: pointer; padding: 0; margin-bottom: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards and stats */
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-family: Sora, sans-serif; font-size: 26px; }
.stat.accent { background: var(--red); border-color: var(--red); color: #fff; }
.stat.accent .muted { color: #F6CDD1; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.info-grid div { display: flex; flex-direction: column; gap: 2px; }
.info-grid span:first-child { font-size: 12px; color: var(--muted); }
.info-grid span:last-child { font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: 600 14px 'Plus Jakarta Sans', sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--red); border-bottom-color: var(--red); }

/* Tables */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow-x: auto; }
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-tools h2 { font-size: 16px; }
.table-tools input[type="search"] { max-width: 240px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; background: #FAFAFB; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #FAFAFB; }
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions .btn { margin-left: 4px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--line-soft); display: block; }

/* Status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; background: var(--line-soft); color: #4C4C50; }
.pill.done, .pill.paid, .pill.confirmed, .pill.booked, .pill.yes { background: var(--green-tint); color: var(--green); }
.pill.current, .pill.due, .pill.submitted, .pill.visited { background: var(--amber-tint); color: var(--amber); }
.pill.no { background: var(--red-tint); color: var(--red); }

/* Modal */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(680px, calc(100% - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal::backdrop { background: rgba(20, 20, 22, .45); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal .error { padding: 0 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; transition: transform .25s ease; z-index: 10; }
.toast.show { transform: translateX(-50%) translateY(0); }
