@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

:root {
  --p-950: #1c0022;
  --p-900: #2b0033;
  --p-800: #3a0043;
  --p-700: #470051;
  --p-600: #560060;
  --orange: #ff8948;
  --orange-hi: #ffa06b;
  --cream: #fff7f1;
  --muted: rgba(255, 247, 241, 0.6);
  --faint: rgba(255, 247, 241, 0.36);
  --line: rgba(255, 247, 241, 0.12);
  --line-2: rgba(255, 247, 241, 0.22);
  --surface: rgba(255, 247, 241, 0.045);
  --surface-hi: rgba(255, 247, 241, 0.08);
  --ok: #56d9a3;
  --warn: #ffc24b;
  --late: #ff7a7a;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --pill: 999px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1100px 620px at 10% -12%, rgba(255, 137, 72, 0.15), transparent 60%),
    radial-gradient(900px 520px at 100% -5%, rgba(104, 0, 122, 0.6), transparent 55%),
    var(--p-900);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- tooltips (labels live here now) ---------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--p-950);
  color: var(--cream);
  padding: 7px 11px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 137, 72, 0.3);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tip].tip-wide::after { white-space: normal; width: 230px; text-align: left; }
[data-tip].tip-left::after { left: auto; right: 0; transform: translateY(5px); }
[data-tip].tip-left:hover::after { transform: translateY(0); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(43, 0, 51, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--orange);
  line-height: 1;
}
.wordmark span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-left: 10px;
}

.nav { display: flex; align-items: center; gap: 6px; }
.nav form { display: flex; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-hi); color: var(--cream); border-color: var(--line-2); }
.icon-btn.active { background: rgba(255, 137, 72, 0.14); color: var(--orange); border-color: rgba(255, 137, 72, 0.32); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn { position: relative; }
.icon-btn .badge {
  position: absolute;
  top: -1px;
  right: -1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--pill);
  background: var(--orange);
  color: var(--p-950);
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  border: 2px solid var(--p-900);
}

/* ---------- requests ---------- */
.req {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  transition: all 0.16s ease;
}
.req:hover { border-color: var(--line-2); }
.req.done { opacity: 0.5; }
.req-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 9px;
}
.req-head .who { color: var(--orange-hi); }
.req-text { font-size: 14.5px; line-height: 1.55; color: var(--cream); white-space: pre-wrap; word-break: break-word; }
.req-foot { display: flex; align-items: center; gap: 10px; margin-top: 13px; flex-wrap: wrap; }
.req-foot form { display: flex; }
.link-sm { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.link-sm:hover { color: var(--orange); }
.tabs { display: flex; gap: 8px; }

/* ---------- layout ---------- */
.container { max-width: 940px; margin: 0 auto; padding: 30px 20px 70px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: default;
}
.chip b { color: var(--cream); font-weight: 700; }
.chip.accent { background: rgba(255, 137, 72, 0.12); border-color: rgba(255, 137, 72, 0.3); color: var(--orange-hi); }
.chip.alert { background: rgba(255, 122, 122, 0.12); border-color: rgba(255, 122, 122, 0.3); color: var(--late); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 16px;
}

/* ---------- chat rows ---------- */
.rows { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all 0.16s ease;
}
.row:hover { background: var(--surface-hi); border-color: var(--line-2); transform: translateY(-1px); }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: default;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(86, 217, 163, 0.14); }
.dot.warning { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 194, 75, 0.14); }
.dot.overdue { background: var(--late); box-shadow: 0 0 0 4px rgba(255, 122, 122, 0.16); }
.dot.disabled { background: var(--faint); }

.row-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: default;
  flex-shrink: 0;
}
.row-meta.overdue { color: var(--late); }

.row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.row-actions form { display: flex; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.btn:hover { background: var(--surface-hi); border-color: var(--cream); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--p-950); }
.btn.primary:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.btn.block { width: 100%; justify-content: center; }
.btn.small-btn { padding: 7px 16px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 22px; }

.micro-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.hint-dot {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(28, 0, 34, 0.5);
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.16s ease, background 0.16s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(28, 0, 34, 0.75);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }

.input-unit { position: relative; max-width: 190px; }
.input-unit input { padding-right: 46px; }
.input-unit::after {
  content: "дн";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  pointer-events: none;
}

/* ---------- toggles ---------- */
.toggles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 11px 17px 11px 13px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease;
}
.switch:hover { border-color: var(--line-2); background: var(--surface-hi); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }

.track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: var(--pill);
  background: rgba(28, 0, 34, 0.7);
  border: 1px solid var(--line-2);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--faint);
  transition: all 0.18s ease;
}
.switch input:checked + .track { background: rgba(255, 137, 72, 0.28); border-color: var(--orange); }
.switch input:checked + .track .thumb { left: 19px; background: var(--orange); }
/* input is visually hidden, so surface keyboard focus on the track */
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(255, 137, 72, 0.45); }

.switch-text { font-size: 14px; font-weight: 600; color: var(--muted); }
.switch input:checked ~ .switch-text { color: var(--cream); }

/* ---------- history ---------- */
.log { display: flex; flex-direction: column; }
.log-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.log-item:first-child { padding-top: 0; }
.log-item:last-child { border-bottom: none; padding-bottom: 0; }
.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.tag {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--surface-hi);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag.err { background: rgba(255, 122, 122, 0.16); color: var(--late); }
.log-text { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------- states ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.3);
  color: var(--orange);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty p { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; line-height: 1.6; }

.bot-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 17px;
  border-radius: var(--pill);
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.32);
  color: var(--orange-hi);
  font-size: 14px;
  font-weight: 700;
}

.msg {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 16px;
}
.msg.error { background: rgba(255, 122, 122, 0.14); border: 1px solid rgba(255, 122, 122, 0.32); color: var(--late); }
.msg.ok { background: rgba(86, 217, 163, 0.14); border: 1px solid rgba(86, 217, 163, 0.32); color: var(--ok); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 370px; text-align: center; }
.login-card .wordmark { font-size: 40px; margin-bottom: 8px; }
.login-sub { color: var(--faint); font-size: 13.5px; font-weight: 500; margin: 0 0 30px; }
.login-card form { text-align: left; }

/* ---------- misc ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  transition: color 0.16s ease;
}
.back:hover { color: var(--orange); }
.back svg { width: 14px; height: 14px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .container { padding: 22px 15px 60px; }
  h1 { font-size: 21px; }
  .row { padding: 13px 14px; gap: 11px; }
  .row-meta { font-size: 12px; }
  [data-tip]::after { display: none; }
}
