@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Oswald:wght@500;600;700&display=swap");

:root {
  --bg: #f7f7f7;
  --card: #ffffff;
  --ink: #1f1f1f;
  --muted: #5f5f5f;
  --line: #e6e6e6;
  --accent: #d3413f;
  --accent-hover: #b83230;
  --accent-hot: #f34f4c;
  --asphalt: #d3413f;
  --asphalt-2: #b83230;
  --signal: #ffffff;
  --danger: #b42318;
  --ok: #1f6b45;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(31, 31, 31, 0.04), 0 8px 24px rgba(31, 31, 31, 0.06);
  --font: "Open Sans", system-ui, sans-serif;
  --display: "Oswald", "Open Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 380px at 0% -10%, rgba(211, 65, 63, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.45;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  background: #fff;
  color: var(--ink);
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 2px 12px rgba(31, 31, 31, 0.06);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
.brand-text { line-height: 1.05; }
.brand-text small {
  display: block;
  font-size: .72rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
}
.top-page { color: var(--muted); font-size: .9rem; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 42px;
  height: 42px;
  padding: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--ink);
  border-radius: 2px;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.nav a {
  color: var(--ink-soft, #434343);
  padding: 6px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
}
.nav a:hover, .nav a.is-on {
  background: rgba(211, 65, 63, 0.1);
  color: var(--accent);
  text-decoration: none;
}
.nav-logout { opacity: .75; color: var(--muted) !important; }
.nav-head, .nav-close, .nav-scrim { display: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
h2 { font-family: var(--display); font-size: 1.1rem; margin: 0 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.block { width: 100%; }
.btn-link {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0 4px;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}
.flash.ok { background: #e7f6ee; color: var(--ok); }
.flash.err { background: #fdeceb; color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea,
table input, table select,
.search-bar input, .catalog-row select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.hint { margin: 4px 0 0; font-size: .82rem; color: var(--muted); }
.hint.is-err { color: var(--danger); }
.hint.is-ok { color: var(--ok); }
.new-client-box {
  background: #f7f1e8;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
}
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1; }

.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 15;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.combo-list li {
  padding: 8px 12px;
  cursor: pointer;
}
.combo-list li:hover,
.combo-list li:focus {
  background: #f3ebe1;
  outline: none;
}
.stack { display: grid; gap: 12px; }
.stack .field { margin: 0; }

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-bar input { flex: 1; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f0e8dc;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .9em;
}
.muted { color: var(--muted); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.plain-list li:last-child { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: #f3e0df;
  color: var(--ink);
}
.st-booked { background: #e8eef8; }
.st-accepted { background: #f3e0df; }
.st-work { background: #fde9c8; color: #8a4b00; }
.st-done { background: #d9f0e3; color: var(--ok); }
.st-out { background: #dceee8; color: #0f5c4a; }
.st-cancel { background: #f5e0de; color: var(--danger); }

.tabs-row, .chip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  font-size: .9rem;
}
.chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:hover { text-decoration: none; border-color: var(--accent); }

.inline-edit {
  display: grid;
  grid-template-columns: 2fr 1fr .7fr auto;
  gap: 8px;
  padding: 8px 0;
  align-items: center;
}
.is-off { opacity: .55; }
.catalog-row { margin-bottom: 10px; max-width: 360px; }

.guest-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 320px at 15% 0%, rgba(255,255,255,.18), transparent 55%),
    linear-gradient(160deg, #b83230 0%, #d3413f 45%, #f34f4c 100%);
}
.guest { width: min(420px, 92vw); }
.guest-box {
  background: var(--card);
  border-radius: 8px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.guest-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  text-align: center;
}
.guest-brand img {
  height: 48px;
  width: auto;
}
.guest-brand .crm-tag {
  font-family: var(--display);
  font-size: .85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.guest-box h1 { margin: 0 0 4px; font-family: var(--display); text-transform: uppercase; }
.guest-box .sub { margin: 0 0 16px; color: var(--muted); }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .top-page { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 25;
  }
  .nav-scrim[hidden] { display: none !important; }
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 88vw);
    height: 100dvh;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
    transform: translateX(105%);
    transition: transform .2s ease;
    z-index: 30;
    border-left: 3px solid var(--accent);
    box-shadow: -8px 0 24px rgba(0,0,0,.12);
  }
  body.nav-open .nav { transform: translateX(0); }
  .nav-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ink);
    margin-bottom: 8px;
    font-weight: 700;
  }
  .nav-close {
    display: block;
    background: transparent;
    border: 0;
    color: var(--ink);
    font-size: 1.6rem;
    cursor: pointer;
  }
  .nav a { color: var(--ink); }
  .inline-edit { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; }
}
