:root {
  color-scheme: light;
  --navy: #17365d;
  --blue: #1f4e78;
  --teal: #0f6b6d;
  --green: #138a5b;
  --text: #162233;
  --muted: #66758a;
  --line: #dbe3ed;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --shadow: 0 12px 38px rgba(20, 44, 73, .1);
  --radius: 18px;
  --status-new: #2f80ed;
  --status-work: #e0b000;
  --status-waiting: #f57920;
  --status-done: #18a36b;
  --status-canceled: #6b7280;
  --status-overdue: #dc3545;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0, rgba(31, 78, 120, .1), transparent 32rem),
    var(--canvas);
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .62; }

.app { width: min(1500px, 100%); margin: 0 auto; padding: 0 22px 42px; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 22px; line-height: 1.1; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.topbar__actions .button { white-space: nowrap; }
.company-link { width: 44px; height: 44px; flex: 0 0 auto; display: block; overflow: hidden; border: 1px solid rgba(23,54,93,.16); border-radius: 13px; background: white; box-shadow: 0 6px 16px rgba(23,54,93,.14); transition: transform .14s, box-shadow .14s; }
.company-link--brand { width: 42px; height: 42px; box-shadow: 0 8px 20px rgba(23, 54, 93, .18); }
.company-link:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(23,54,93,.2); }
.company-link img { width: 100%; height: 100%; display: block; object-fit: cover; }

.login-gate {
  max-width: 620px;
  margin: 36px auto 0;
  padding: 26px;
  border: 1px solid rgba(23, 54, 93, .09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-gate h2 { margin: 6px 0 8px; font-size: 24px; }
.login-gate p { max-width: 500px; margin: 0 auto 18px; color: var(--muted); line-height: 1.45; }

.composer {
  position: sticky;
  z-index: 20;
  top: 0;
  max-height: 620px;
  overflow: hidden;
  padding: 18px 20px 38px;
  border: 1px solid rgba(23, 54, 93, .09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform-origin: top;
  transition: max-height .24s ease, opacity .2s ease, padding .24s ease, border-width .24s ease, transform .24s ease, box-shadow .24s ease;
}
.composer-is-unpinned .composer {
  position: relative;
  top: auto;
  z-index: 1;
}
.composer-is-suppressed .composer {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  box-shadow: none;
}
.composer-pin-toggle {
  position: absolute;
  right: 14px;
  bottom: 10px;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid #b8d7d5;
  border-radius: 999px;
  color: white;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(15, 107, 109, .15);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.composer-pin-toggle[aria-pressed="false"] {
  color: var(--navy);
  border-color: #cbd7e5;
  background: rgba(255,255,255,.86);
  box-shadow: none;
}
.composer-pin-toggle:hover { filter: brightness(.98); }

.composer__heading, .registry__toolbar, .dialog__heading, .details-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.composer h2, .registry h2, .auth-dialog h2 { margin: 1px 0 0; font-size: 21px; }
.composer__hint { color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.form-grid { display: grid; gap: 12px; }
.form-grid--primary {
  grid-template-columns: minmax(180px, 1fr) minmax(290px, 2.2fr) 155px minmax(220px, auto);
  align-items: end;
  margin-top: 14px;
}
.form-grid--primary.has-other { grid-template-columns: minmax(170px, .9fr) minmax(170px, .9fr) minmax(260px, 1.8fr) 150px minmax(220px, auto); }
.form-grid--advanced { grid-template-columns: repeat(3, minmax(170px, 1fr)); padding: 14px 0 2px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.field > span { color: #4d5c70; font-size: 12px; font-weight: 700; }
.field--grow, .field--wide { grid-column: span 2; }
.field input, .field select, .field textarea, .search input, .filters select {
  width: 100%;
  border: 1px solid #cdd7e3;
  border-radius: 10px;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input, .field select, .search input, .filters select { min-height: 42px; padding: 8px 11px; }
.field textarea { resize: vertical; padding: 10px 11px; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .filters select:focus {
  border-color: #3a79ae;
  box-shadow: 0 0 0 3px rgba(58, 121, 174, .14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
  transition: transform .12s, background .16s, border-color .16s;
}
.button:active { transform: translateY(1px); }
.button--primary { color: #fff; background: linear-gradient(135deg, var(--teal), #11877d); box-shadow: 0 7px 17px rgba(15, 107, 109, .2); }
.button--primary:hover { background: linear-gradient(135deg, #0d5d5f, #0f756d); }
.button--ghost { color: var(--navy); border-color: #cbd7e5; background: rgba(255,255,255,.72); }
.button--ghost:hover { background: #edf3f9; }
.button--soft { color: #0d5f69; border-color: #bde5e0; background: #e9f8f7; }
.button--soft:hover { background: #d9f1ee; }
.button--danger { color: #a01e2d; border-color: #efc3ca; background: #fff2f4; }
.button--danger:hover { color: #fff; border-color: #b72736; background: #b72736; }
.button--small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.button--full { width: 100%; margin-top: 4px; }
.button--add { min-width: 180px; }
.button--add span { font-size: 19px; vertical-align: -1px; }
.composer-actions { display: flex; align-items: stretch; gap: 8px; }
.composer-actions .button--add { flex: 1 1 auto; }
.button--copy-cancel { flex: 0 0 auto; min-width: 92px; }

.advanced { margin-top: 10px; border-top: 1px solid var(--line); }
.advanced summary { width: max-content; padding-top: 10px; color: var(--blue); font-size: 13px; font-weight: 750; cursor: pointer; }

.content { padding-top: 18px; }
.files-view { margin-top: 0; padding: 20px; border: 1px solid rgba(23, 54, 93, .08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.files-view__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.files-view__header h2 { margin: 2px 0 4px; font-size: 24px; }
.files-view__header p { margin: 0; color: var(--muted); font-size: 13px; }
.files-error { margin-top: 16px; padding: 12px 14px; border: 1px solid #efc3ca; border-radius: 11px; color: #9f1e2d; background: #fff2f4; font-weight: 700; }
.files-section-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.files-section-card { min-height: 132px; padding: 19px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 7px; border: 1px solid #cbdbea; border-radius: 15px; color: var(--text); background: linear-gradient(145deg, #fff, #f2f7fb); text-align: left; box-shadow: 0 7px 22px rgba(23, 54, 93, .06); }
.files-section-card:hover { border-color: #83b9ba; background: linear-gradient(145deg, #fff, #eaf7f5); transform: translateY(-1px); }
.files-section-card strong { color: var(--navy); font-size: 18px; }
.files-section-card span { color: var(--teal); font-size: 13px; font-weight: 800; }
.files-section-card small { color: var(--muted); font-size: 11px; }
.files-browser { margin-top: 18px; }
.files-browser__toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.files-breadcrumbs { min-width: 0; padding: 0 0 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.files-breadcrumbs button { max-width: 260px; padding: 4px 7px; overflow: hidden; border: 0; border-radius: 7px; color: var(--blue); background: #edf4fa; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.files-breadcrumbs button + button::before { content: '›'; margin-right: 7px; color: var(--muted); }
.files-breadcrumbs button:disabled { color: var(--text); background: transparent; opacity: 1; cursor: default; }
.files-loading { padding: 22px 10px; color: var(--muted); text-align: center; }
.files-entry-list { padding-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.files-entry { min-height: 62px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.files-entry[data-type="directory"] { width: 100%; grid-template-columns: minmax(0, 1fr); text-align: left; background: #f7fbff; }
.files-entry__main { min-width: 0; padding: 0; display: flex; align-items: center; gap: 11px; border: 0; color: inherit; background: transparent; text-align: left; }
button.files-entry__main { width: 100%; }
.files-entry__icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #eaf2f9; font-size: 20px; }
.files-entry__text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.files-entry__text strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.files-entry__text small { color: var(--muted); font-size: 11px; }
.files-entry__download { text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { min-height: 72px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border: 1px solid transparent; border-radius: 14px; color: var(--text); text-align: left; }
.stat span { font-size: 13px; font-weight: 750; }
.stat strong { font-size: 25px; }
.stat--new { background: #eaf3ff; border-color: #c9ddf7; }
.stat--work { background: #fff7d6; border-color: #efe1a0; }
.stat--overdue { background: #feecef; border-color: #f3c3c9; }
.stat--done { background: #e8f7ef; border-color: #bfe4d0; }
.stat:hover { filter: brightness(.985); border-color: rgba(23, 54, 93, .24); }

.registry { padding: 18px; border: 1px solid rgba(23, 54, 93, .08); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(23, 54, 93, .06); }
.registry__toolbar { margin-bottom: 14px; }
.registry-title-button { margin: 0; padding: 0; border: 0; color: var(--text); background: transparent; font: inherit; font-weight: 800; text-align: left; }
.registry-title-button:hover, .registry-title-button.is-active { color: var(--teal); }
.filters { display: flex; align-items: center; gap: 8px; }
.search input { width: 210px; }
.filters select { width: 160px; }

.request-list { display: flex; flex-direction: column; gap: 9px; }
.request-list--completed { margin-top: 12px; }
.list-footer { margin-top: 12px; padding: 10px 0 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px; }
.request-card { overflow: hidden; border: 1px solid var(--line); border-left: 6px solid var(--status-new); border-radius: 14px; background: white; transition: box-shadow .16s, transform .16s; }
.request-card:hover { box-shadow: 0 9px 25px rgba(21, 48, 78, .08); }
.request-card[data-status="in_progress"] { border-left-color: var(--status-work); background: #fffdf3; }
.request-card[data-status="waiting"] { border-left-color: var(--status-waiting); background: #fff9f4; }
.request-card[data-status="done"] { border-left-color: var(--status-done); background: #f5fcf8; }
.request-card[data-status="canceled"] { border-left-color: var(--status-canceled); background: #f7f7f8; opacity: .82; }
.request-card[data-control="overdue"] { border-left-color: var(--status-overdue); background: #fff7f8; }

.request-card__summary { min-height: 82px; padding: 13px 14px; display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--status-new); box-shadow: 0 0 0 4px rgba(47,128,237,.12); }
.request-card[data-status="in_progress"] .status-dot { background: var(--status-work); box-shadow: 0 0 0 4px rgba(224,176,0,.13); }
.request-card[data-status="waiting"] .status-dot { background: var(--status-waiting); box-shadow: 0 0 0 4px rgba(245,121,32,.12); }
.request-card[data-status="done"] .status-dot { background: var(--status-done); box-shadow: 0 0 0 4px rgba(24,163,107,.12); }
.request-card[data-status="canceled"] .status-dot { background: var(--status-canceled); box-shadow: 0 0 0 4px rgba(107,114,128,.12); }
.request-card[data-control="overdue"] .status-dot { background: var(--status-overdue); box-shadow: 0 0 0 4px rgba(220,53,69,.12); }

.request-card__main { min-width: 0; }
.request-card__meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 11px; }
.request-card__id { font-variant-numeric: tabular-nums; }
.request-card__client { padding: 2px 7px; border-radius: 99px; color: var(--navy); background: #edf3f9; font-weight: 750; }
.request-card__control { padding: 2px 7px; border-radius: 99px; color: #a20e1d; background: #ffe3e7; font-weight: 800; }
.request-card__title { margin: 5px 0 4px; overflow: hidden; font-size: 16px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.request-card__facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #56667a; font-size: 12px; }
.request-card__facts span { display: inline-flex; align-items: center; gap: 4px; }
.request-card__actions { display: flex; align-items: center; gap: 8px; }
.compact-select select { min-height: 36px; max-width: 150px; padding: 5px 28px 5px 9px; border: 1px solid #cbd7e5; border-radius: 9px; background: white; }

.request-card__details { padding: 15px; border-top: 1px solid var(--line); background: rgba(244,247,251,.68); }
.details-actions { margin-top: 13px; }
.details-actions__buttons { display: flex; align-items: center; gap: 8px; }
.request-card__updated { color: var(--muted); font-size: 11px; }

.empty-state { padding: 50px 20px; display: grid; place-items: center; gap: 5px; color: var(--muted); text-align: center; }
.empty-state--compact { padding: 24px 14px; }
.empty-state strong { color: var(--text); font-size: 18px; }

.completed-block { margin-top: 18px; border-top: 1px solid var(--line); }
.completed-block summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--navy); font-weight: 800; cursor: pointer; list-style: none; }
.completed-block summary::-webkit-details-marker { display: none; }
.completed-block summary::before { content: '▸'; color: var(--teal); transition: transform .16s; }
.completed-block[open] summary::before { transform: rotate(90deg); }
.completed-block summary span { margin-right: auto; }
.completed-block summary strong { min-width: 32px; padding: 3px 9px; border-radius: 99px; color: var(--teal); background: #e8f4f2; text-align: center; }

.auth-dialog { width: min(420px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 17px; box-shadow: 0 24px 80px rgba(11, 29, 50, .28); }
.auth-dialog::backdrop { background: rgba(12, 25, 42, .54); backdrop-filter: blur(3px); }
.auth-dialog form { padding: 21px; display: grid; gap: 14px; }
.auth-dialog p { margin: 0; color: var(--muted); font-size: 13px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: #eef2f6; font-size: 24px; line-height: 1; }
.form-error { padding: 9px 10px; border-radius: 9px; color: #a20e1d !important; background: #ffe8eb; }

.directory-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: min(860px, calc(100dvh - 28px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--canvas);
  box-shadow: 0 24px 80px rgba(11, 29, 50, .3);
}
.directory-dialog::backdrop { background: rgba(12, 25, 42, .58); backdrop-filter: blur(3px); }
.directory-shell { max-height: min(860px, calc(100dvh - 28px)); display: flex; flex-direction: column; overflow: hidden; }
.directory-header { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: white; }
.directory-header h2 { margin: 2px 0 0; font-size: 23px; }
.directory-tabs { padding: 0 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-bottom: 1px solid var(--line); background: white; }
.directory-tab { min-height: 48px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; font-weight: 800; }
.directory-tab span { min-width: 25px; margin-left: 5px; padding: 2px 7px; display: inline-block; border-radius: 99px; background: #edf2f7; }
.directory-tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.directory-panel { min-height: 0; padding: 14px 18px 18px; display: flex; flex: 1; flex-direction: column; gap: 14px; overflow-y: auto; }
.directory-panel[hidden] { display: none; }
.directory-editor { position: sticky; z-index: 2; top: 0; padding: 15px; border: 1px solid #d6e0eb; border-radius: 14px; background: rgba(255,255,255,.98); box-shadow: 0 8px 25px rgba(23,54,93,.08); }
.directory-editor--compact { position: sticky; }
.directory-editor__heading { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.directory-note { color: var(--muted); font-size: 12px; font-weight: 700; }
.directory-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.directory-form-grid--employee { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.directory-form-grid--employee .check-field { grid-column: span 2; }
.employee-telegram-box { margin-top: 10px; border: 1px solid #d6e0eb; border-radius: 12px; background: #f8fbfd; }
.employee-telegram-box summary { padding: 10px 12px; color: var(--blue); font-weight: 800; cursor: pointer; }
.employee-telegram-box[open] summary { border-bottom: 1px solid #dbe3ed; }
.directory-form-grid--employee-telegram { padding: 12px; }
.directory-help { margin: 0; padding: 0 12px 12px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.directory-save { width: 100%; margin-top: 12px; }
.directory-actions-row { margin-top: 12px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.directory-actions-row .directory-save { margin-top: 0; }
.check-field { min-height: 42px; padding: 8px 11px; display: flex; align-items: center; gap: 9px; border: 1px solid #cdd7e3; border-radius: 10px; background: white; color: #4d5c70; font-size: 12px; font-weight: 700; }
.check-field input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--teal); }
.directory-list { display: flex; flex-direction: column; gap: 8px; }
.directory-card { padding: 12px 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.directory-card.is-inactive { opacity: .62; background: #f5f6f8; }
.directory-card__body { min-width: 0; }
.directory-card__body > strong { font-size: 15px; }
.directory-card__meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12px; }
.directory-card__actions { display: flex; align-items: center; gap: 6px; }
.directory-empty { padding: 36px 18px; border: 1px dashed #cbd7e5; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.65); text-align: center; }
.telegram-rule { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #cfe0e4; border-radius: 11px; color: #315160; background: #f2fbfc; font-size: 13px; line-height: 1.35; }
.telegram-status-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.telegram-status-grid span { padding: 8px 10px; border-radius: 10px; background: #f4f7fb; }
.telegram-actions { margin-top: 12px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 8px; }
.telegram-diagnostics { margin: 12px 0 0; padding: 12px; overflow: auto; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 12px; color: #26384d; background: #f8fafc; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.scheduled-box { position: static; }
.scheduled-list .directory-card__actions { grid-template-columns: 1fr; }
.deleted-requests-box { margin-top: 4px; border-top: 1px solid var(--line); }
.deleted-requests-box summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--navy); font-weight: 800; cursor: pointer; list-style: none; }
.deleted-requests-box summary::-webkit-details-marker { display: none; }
.deleted-requests-box summary::before { content: '▸'; color: var(--teal); transition: transform .16s; }
.deleted-requests-box[open] summary::before { transform: rotate(90deg); }
.deleted-requests-box summary span { margin-right: auto; }
.deleted-requests-box summary strong { min-width: 28px; padding: 2px 8px; border-radius: 99px; color: var(--teal); background: #e8f4f2; text-align: center; }
.deleted-requests-box .directory-list { margin-top: 8px; }

.reminder-dialog { width: min(540px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 17px; box-shadow: 0 24px 80px rgba(11, 29, 50, .28); }
.reminder-dialog::backdrop, .image-dialog::backdrop { background: rgba(12, 25, 42, .54); backdrop-filter: blur(3px); }
.reminder-dialog form { padding: 21px; display: grid; gap: 14px; }
.dialog-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.reminder-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reminder-grid .field--wide { grid-column: 1 / -1; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

.attachment-field { grid-column: 1 / -1; }
.attachment-box { display: grid; gap: 8px; }
.attachment-dropzone { padding: 14px; display: grid; gap: 4px; border: 1px dashed #b9c9d9; border-radius: 12px; color: #42546a; background: #f8fbfd; outline: none; }
.attachment-dropzone:focus, .attachment-dropzone.is-dragover { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 107, 109, .12); background: #eefaf8; }
.attachment-dropzone.is-uploading { opacity: .65; }
.attachment-dropzone small { color: var(--muted); line-height: 1.35; }
.attachment-actions { display: flex; gap: 8px; }
.attachment-list { display: grid; gap: 8px; }
.attachment-empty { padding: 10px 12px; border-radius: 10px; color: var(--muted); background: #f4f7fb; font-size: 12px; }
.attachment-item { padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: white; }
.attachment-item__body { min-width: 0; display: grid; gap: 3px; }
.attachment-item__body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item__link { overflow: hidden; color: var(--navy); font-weight: 800; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item__link:hover { color: var(--teal); text-decoration: underline; }
.attachment-item__body span { color: var(--muted); font-size: 12px; }
.attachment-item__actions { display: flex; gap: 6px; align-items: center; }
.attachment-item__actions a { text-decoration: none; display: inline-flex; align-items: center; }
.group-reminder-box { grid-column: 1 / -1; display: block; padding: 0; overflow: hidden; border: 1px solid #d5e4ef; border-radius: 14px; background: #f8fbfd; }
.group-reminder-summary { min-height: 44px; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--navy); font-weight: 800; cursor: pointer; list-style: none; }
.group-reminder-summary::-webkit-details-marker { display: none; }
.group-reminder-summary::before { content: '▶'; color: var(--blue); font-size: 12px; transition: transform .16s ease; }
.group-reminder-summary span { margin-right: auto; }
.group-reminder-summary small { color: var(--muted); font-size: 12px; font-weight: 700; }
.group-reminder-box[open] .group-reminder-summary { border-bottom: 1px solid #dbe6f1; }
.group-reminder-box[open] .group-reminder-summary::before { transform: rotate(90deg); }
.group-reminder-panel { padding: 12px; }
.group-reminder-toggle { margin-bottom: 10px; }
.group-reminder-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.group-reminder-note { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.request-comments { grid-column: 1 / -1; }
.request-comments__list { display: grid; gap: 8px; }
.request-comment { padding: 10px 12px; display: grid; gap: 5px; border: 1px solid #d9e4ef; border-radius: 11px; background: #f8fbfd; }
.request-comment__meta { color: var(--muted); font-size: 12px; font-weight: 700; }
.request-comment__text { color: #172033; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }

.image-dialog { width: min(920px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 18px; background: transparent; }
.image-dialog__shell { position: relative; padding: 42px 0 0; }
.image-dialog__close { position: absolute; top: 0; right: 0; z-index: 2; }
.image-dialog img { max-width: 100%; max-height: calc(100dvh - 90px); display: block; margin: 0 auto; border-radius: 14px; background: white; box-shadow: 0 18px 60px rgba(0,0,0,.32); object-fit: contain; }

.toast { position: fixed; z-index: 80; right: 22px; bottom: 22px; max-width: min(440px, calc(100vw - 30px)); padding: 12px 16px; border-radius: 11px; color: white; background: #183a5c; box-shadow: 0 12px 35px rgba(13, 35, 59, .26); font-weight: 700; }
.toast.toast--error { background: #a5222f; }
.toast.toast--success { background: #107a53; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 1050px) {
  .form-grid--primary, .form-grid--primary.has-other { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--grow { grid-column: span 2; }
  .composer-actions { grid-column: span 2; }
  .button--add { width: 100%; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app { padding: 0 10px 24px; }
  .topbar { min-height: 60px; align-items: flex-start; gap: 10px; padding: 8px 0; }
  .brand h1 { font-size: 19px; }
  .brand p { display: none; }
  .topbar__actions { flex: 1 1 0; flex-wrap: wrap; gap: 5px; padding-top: 1px; }
  .topbar__actions .button { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  .company-link { width: 36px; height: 36px; border-radius: 10px; }
  .login-gate { margin-top: 18px; padding: 20px 14px; border-radius: 14px; }
  .login-gate h2 { font-size: 20px; }
  .composer { top: 0; padding: 12px 12px 38px; border-radius: 14px; }
  .composer__heading { align-items: flex-start; }
  .composer h2 { font-size: 18px; }
  .composer__hint { display: none; }
  .form-grid--primary, .form-grid--primary.has-other { grid-template-columns: 1fr 116px; gap: 8px; }
  .form-grid--primary .field:first-child, .field--other, .field--grow { grid-column: span 2; }
  .field > span { font-size: 11px; }
  .field input, .field select, .search input, .filters select { min-height: 40px; }
  .composer-actions { grid-template-columns: 1fr 92px; display: grid; }
  .button--add { min-width: 0; padding-inline: 8px; font-size: 12px; }
  .advanced summary { padding-top: 8px; }
  .form-grid--advanced { grid-template-columns: 1fr 1fr; max-height: 38vh; overflow: auto; }
  .form-grid--advanced .field--wide { grid-column: span 2; }
  .content { padding-top: 10px; }
  .files-view { padding: 14px 12px; border-radius: 14px; }
  .files-view__header { align-items: stretch; flex-direction: column; gap: 12px; }
  .files-view__header .button { width: 100%; }
  .files-view__header h2 { font-size: 21px; }
  .files-section-grid { grid-template-columns: 1fr; gap: 8px; }
  .files-section-card { min-height: 102px; padding: 15px; }
  .files-browser__toolbar { align-items: stretch; flex-direction: column; padding-bottom: 10px; }
  .files-browser__toolbar .button { align-self: flex-end; }
  .files-breadcrumbs { padding-bottom: 0; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; }
  .files-breadcrumbs button { flex: 0 0 auto; max-width: 210px; }
  .files-entry { min-height: 68px; padding: 9px; }
  .files-entry__text strong { font-size: 13px; }
  .files-entry__download { min-height: 36px; padding-inline: 9px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 10px; }
  .stat { min-height: 56px; padding: 7px; flex-direction: column; justify-content: center; gap: 2px; text-align: center; }
  .stat span { font-size: 9px; }
  .stat strong { font-size: 20px; }
  .registry { padding: 10px; border-radius: 14px; }
  .registry__toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .registry h2 { font-size: 19px; }
  .filters { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; }
  .search input, .filters select { width: 100%; }
  .list-footer { align-items: stretch; flex-direction: column; gap: 7px; }
  .list-footer .button { width: 100%; min-height: 40px; }
  .completed-block { margin-top: 14px; }
  .request-card__summary { min-height: 90px; padding: 11px 10px; grid-template-columns: 11px minmax(0, 1fr); gap: 9px; }
  .request-card__actions { grid-column: 2; justify-content: space-between; }
  .request-card__title { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .request-card__facts { gap: 4px 9px; font-size: 11px; }
  .compact-select { flex: 1; }
  .compact-select select { width: 100%; max-width: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .field--wide { grid-column: span 1; }
  .details-actions { align-items: stretch; flex-direction: column; }
  .details-actions__buttons { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details-actions__buttons .button { width: 100%; }
  .attachment-item { grid-template-columns: 1fr; }
  .attachment-item__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attachment-item__actions .button { width: 100%; justify-content: center; }
  .request-comment { padding: 9px 10px; }
  .directory-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .directory-shell { height: 100dvh; max-height: 100dvh; }
  .directory-header { padding: calc(12px + env(safe-area-inset-top)) 14px 10px; }
  .directory-tabs { padding: 0 10px; grid-template-columns: repeat(2, 1fr); }
  .directory-tab { font-size: 12px; }
  .directory-panel { padding: 10px; }
  .directory-editor { padding: 12px; border-radius: 12px; }
  .directory-form-grid, .directory-form-grid--employee { grid-template-columns: 1fr; }
  .directory-form-grid--employee .check-field { grid-column: span 1; }
  .directory-form-grid--employee-telegram, .reminder-grid, .dialog-actions, .group-reminder-grid { grid-template-columns: 1fr; }
  .directory-actions-row { grid-template-columns: 1fr; }
  .telegram-status-grid, .telegram-actions { grid-template-columns: 1fr; }
  .directory-card { grid-template-columns: 1fr; align-items: stretch; }
  .directory-card__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .directory-card__actions .button { width: 100%; min-height: 40px; }
  .toast { right: 12px; bottom: 12px; }
}

@media (max-width: 420px) {
  .topbar__actions #export-button { display: none; }
  .company-link { width: 34px; height: 34px; }
  .topbar__actions { gap: 4px; }
  .topbar__actions .button { min-height: 34px; padding-inline: 7px; }
  .composer { max-height: 48vh; overflow-y: auto; overscroll-behavior: contain; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters #clear-filter { grid-column: span 2; }
  .request-card__meta { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
