:root {
  --bg: #0f1115; --panel: #12151b; --panel-2: #171a20; --line: #23272f;
  --text: #e8e8ea; --muted: #9aa0aa; --accent: #3a6df0; --danger: #e5484d; --ok: #1f7a55;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 190px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar__brand { font-weight: 700; margin-bottom: 14px; }
.sidebar__item { padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.sidebar__item:hover { background: var(--panel-2); color: var(--text); }
.sidebar__logout { margin-top: auto; }
.sidebar__logout button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px 10px; }
.sidebar__ver { font-size: 11px; color: var(--muted); padding: 8px 10px 0; }
.content { flex: 1; padding: 24px; min-width: 0; }
.btn { display: inline-block; padding: 10px 16px; border: 0; border-radius: 8px;
  background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.btn--primary { background: var(--accent); color: #fff; }
.msg { padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; background: var(--panel-2); }
.msg--error { background: #3a1d1f; color: #ffd7d9; }
.login { max-width: 320px; margin: 12vh auto; display: flex; flex-direction: column; gap: 12px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.login input { padding: 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; }
.notice { max-width: 480px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--panel-2); }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--panel-2); }
.form-narrow { max-width: 520px; }
.inline-form { border-left: 2px solid var(--line); padding-left: 12px; margin-bottom: 8px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters select, .filters input { padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; }
.dot { color: var(--muted); }
.dot--urgent { color: var(--danger); }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--panel-2); color: var(--muted); }
.badge--new { background: #3a3320; color: #e8d9a8; }
.badge--assigned { background: #22303f; color: #bcd6ea; }
.badge--in_progress { background: #223a6b; color: #cbdcff; }
.badge--done { background: #1f4d3b; color: #cdeede; }
.badge--failed { background: #4a2326; color: #ffd3d6; }
.badge--postponed { background: #3a2f45; color: #ded0ee; }

.request-detail { max-width: 760px; }
.rd-head { margin-bottom: 18px; }
.rd-head p { margin: 4px 0; }
.rd-section { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.rd-section h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }

.timeline { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.event { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--panel-2); }
.event:last-child { border-bottom: 0; }
.event__icon { flex-shrink: 0; width: 20px; text-align: center; }
.event__body { min-width: 0; flex: 1; }
.event__meta { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.event__text { white-space: pre-wrap; word-break: break-word; }
.event__atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.attachments__file { color: var(--accent); }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.rd-upload, .rd-comment { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.rd-comment textarea { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; resize: vertical; }

[x-cloak] { display: none !important; }
.status-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.status-actions__simple { margin: 0; }
.closeform { display: flex; flex-direction: column; gap: 6px; }
.closeform__panel { display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); max-width: 340px; }
.closeform__field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.closeform__field textarea, .closeform__field input, .closeform__field select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; resize: vertical; }

.content select,
.content input:not([type=checkbox]):not([type=radio]),
.content textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; max-width: 100%;
}
.content input[type=file] { padding: 6px; }
.content input[type=file]::file-selector-button {
  padding: 6px 12px; margin-right: 10px; border: 0; border-radius: 6px;
  background: var(--panel); color: var(--text); cursor: pointer; font: inherit;
}
.content select:focus, .content input:focus, .content textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 0;
}
.content ::placeholder { color: var(--muted); }

.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { background: var(--panel-2); border-radius: var(--radius); padding: 12px 16px; min-width: 110px; }
.tile__n { font-size: 22px; font-weight: 700; }
.tile__l { font-size: 12px; color: var(--muted); }
.tile--warn .tile__n { color: var(--danger); }
.tile--ok .tile__n { color: #3fb98a; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.bcol { flex: 1 0 200px; min-width: 200px; background: var(--panel); border-radius: var(--radius); padding: 8px; }
.bcol__head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 4px 6px 8px; }
.bcol__n { background: var(--panel-2); border-radius: 20px; padding: 0 8px; }
.bcol__body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.bcol__more { display: block; padding: 8px 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.bcol__more:hover { color: var(--text); }
.bcard { background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
.bcard--urgent { border-left-color: var(--danger); }
.bcard__link { display: block; }
.bcard:hover { outline: 1px solid var(--line); }
.bcard__client { font-weight: 600; font-size: 13px; }
.bcard__problem { font-size: 12px; margin: 2px 0 6px; }
.bcard__meta { font-size: 11px; color: var(--muted); }
/* SortableJS drag-состояния */
.bcard.sortable-chosen { cursor: grabbing; }
.bcard.sortable-ghost { opacity: .4; background: var(--panel); border-left-color: var(--muted); }
.bcard.sortable-drag { outline: 1px solid var(--accent); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border-radius: var(--radius); padding: 20px;
  max-width: 360px; width: 90%; border: 1px solid var(--line); }
.modal h3 { margin: 0 0 12px; }
.modal p { margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }

/* Экран мастера «Мои заявки» */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { padding: 8px 14px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.tab--on { background: var(--accent); color: #fff; }
.today-list { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.tcard { display: block; background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; }
.tcard--urgent { border-left-color: var(--danger); }
.tcard__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tcard__client { font-weight: 600; }
.tcard__addr { font-size: 12px; color: var(--muted); margin: 4px 0; }
.tcard__problem { font-size: 13px; }
.tcard__when { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Колокольчик уведомлений */
.topbar { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 12px; }
.notif-bell { position: relative; }
.notif-bell__btn { position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; min-height: 32px; padding: 4px 10px; font-size: 16px; line-height: 1; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; }
.notif-bell__btn:hover { background: var(--panel); }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  line-height: 16px; text-align: center; }
.notif-dropdown { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  width: 300px; max-width: calc(100vw - 32px); max-height: 360px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-item { border-radius: 8px; }
.notif-item:hover { background: var(--panel-2); }
.notif-item--unread { border-left: 2px solid var(--accent); }
.notif-item__link { display: block; padding: 8px 10px; }
.notif-item__text { display: block; font-size: 13px; word-break: break-word; }
.notif-item__time { display: block; font-size: 11px; margin-top: 2px; }
.notif-empty { padding: 12px 10px; margin: 0; font-size: 13px; }

/* Профиль */
.profile { margin: 0 0 8px; display: flex; flex-direction: column; gap: 2px; }
.profile__row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--panel-2); }
.profile__row dt { width: 120px; flex-shrink: 0; color: var(--muted); margin: 0; }
.profile__row dd { margin: 0; }
.profile__deeplink { margin-top: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel-2); }
.profile__deeplink p { margin: 0 0 6px; }
.profile__deeplink a { color: var(--accent); word-break: break-all; }
.rd-section form { margin-top: 10px; }
.rd-section code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar__logout { margin-top: 0; margin-left: auto; }
  .sidebar__ver { display: none; }
  .content { padding: 16px; }
}

/* Телефон: карточка заявки под палец — крупные кнопки статуса в столбик */
@media (max-width: 560px) {
  .status-actions { flex-direction: column; align-items: stretch; }
  .status-actions__simple, .status-actions .closeform { width: 100%; }
  .status-actions form { width: 100%; }
  .status-actions .btn { width: 100%; min-height: 44px; }
  .closeform__panel { max-width: none; }

  .rd-comment, .rd-upload { flex-direction: column; align-items: stretch; }
  .rd-comment .btn, .rd-upload .btn { width: 100%; min-height: 44px; }

  .board { gap: 8px; }
  .bcol { flex-basis: 82vw; min-width: 82vw; }
}
