@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0a0e14;
  --panel: #10161f;
  --panel-raised: #161e29;
  --hairline: #232d3a;
  --ink: #e4ecf2;
  --ink-dim: #7c8b9c;
  --accent: #4fd6c4;
  --accent-dim: #2f8f83;
  --accent-soft: rgba(79, 214, 196, 0.1);
  --ok: #6fcf97;
  --danger: #e0687a;
  --radius: 6px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body {
  background-image:
    radial-gradient(ellipse 1000px 600px at 100% -10%, rgba(79,214,196,0.05), transparent 60%),
    linear-gradient(180deg, rgba(79,214,196,0.02), transparent 300px);
}

a { color: var(--accent); }
::selection { background: var(--accent-dim); color: #04110e; }

button, input, select, textarea { font-family: var(--font-body); font-size: 15px; }

button {
  background: var(--panel-raised);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
button:hover { border-color: var(--accent-dim); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: #04110e; border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: #6fe3d3; }
button.ghost { background: transparent; }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.icon-btn { padding: 8px 10px; }

input[type=text], input[type=password], input[type=color], textarea, select {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 10px 12px;
  width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: block;
  margin-bottom: 6px;
}

.field { margin-bottom: 18px; }

.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin-bottom: 18px; }
.field-grid-2 .field { margin-bottom: 0; }
@media (max-width: 560px) { .field-grid-2 { grid-template-columns: 1fr; gap: 18px; } }

/* ---------- Owl logo ---------- */
.owl-logo { display: flex; align-items: center; gap: 10px; }
.owl-logo svg { width: 30px; height: 30px; flex-shrink: 0; }
.owl-logo .brand-text { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .01em; line-height: 1.25; }
.owl-logo .brand-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 40px 36px; width: 360px; }
.login-card .owl-logo { justify-content: center; margin-bottom: 28px; }
.login-card h1 { font-family: var(--font-display); font-size: 20px; margin: 0 0 24px; text-align: center; font-weight: 600; color: var(--ink-dim); }
.login-card .field { margin-bottom: 16px; }
.login-card .error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; font-family: var(--font-mono); }
.login-card .hint { margin-top: 18px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); text-align: center; }

/* ---------- App shell: sidebar + content ---------- */
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .owl-logo { padding: 0 8px 24px; border-bottom: 1px solid var(--hairline); margin-bottom: 20px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--radius);
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 3px;
  border: 1px solid transparent;
  user-select: none;
}
.nav-item:hover { color: var(--ink); background: var(--panel-raised); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-dim); }
.nav-item .nav-icon { width: 22px; text-align: center; flex-shrink: 0; font-size: 18px; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--hairline); padding-top: 16px; }

.sidebar .lang-switch { display: flex; gap: 4px; margin-bottom: 14px; }
.sidebar .lang-switch button { flex: 1; padding: 6px; font-family: var(--font-mono); font-size: 11px; }
.sidebar .lang-switch button.active { border-color: var(--accent); color: var(--accent); }

.mini-profile { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.mini-profile:hover { background: var(--panel-raised); cursor: pointer; }
.mini-profile .name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-profile .role { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); text-transform: uppercase; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: #04110e; flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 68px; height: 68px; font-size: 26px; }

/* Ширший робочий простір: таблиці логів/архівів мають вміщатись без
   горизонтального повзунка навіть із бічною панеллю зведення. */
.content { padding: 36px 40px; max-width: 1560px; }

.view { display: none; }
.view.active { display: block; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-family: var(--font-display); font-size: 30px; margin: 0; font-weight: 600; }
.page-head .eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 8px; }

/* ---------- Filter bar ---------- */
.filterbar { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.filterbar button { font-family: var(--font-mono); font-size: 13px; padding: 9px 16px; }
.filterbar button.active { border-color: var(--accent); color: var(--accent); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); margin-bottom: 18px; }
.breadcrumb a, .breadcrumb .crumb-link { color: var(--accent); cursor: pointer; text-decoration: none; }
.breadcrumb a:hover, .breadcrumb .crumb-link:hover { text-decoration: underline; }

/* ---------- Upload zone ---------- */
.upload-zone {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  margin-bottom: 32px;
  background: var(--panel);
  transition: border-color .15s ease, background .15s ease;
}
.upload-zone.drag { border-color: var(--accent); background: var(--panel-raised); }
.upload-zone p { color: var(--ink-dim); font-size: 13px; margin: 10px 0 0; }
.upload-zone .stamp { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* ---------- Date divider ---------- */
.date-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 14px; }
.date-divider:first-of-type { margin-top: 0; }
.date-divider .label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--accent); white-space: nowrap; }
.date-divider .rule { flex: 1; height: 1px; background: repeating-linear-gradient(to right, var(--hairline) 0 4px, transparent 4px 8px); }

/* ---------- File grid / cards ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.file-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, transform .1s ease;
}
.file-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }

.file-card .thumb {
  height: 150px;
  background: var(--panel-raised);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em; color: var(--accent); font-weight: 600;
  overflow: hidden;
}
.file-card .thumb img, .file-card .thumb video { width: 100%; height: 100%; object-fit: cover; }

.file-card .info { padding: 13px 15px; }
.file-card .fname { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .fsub { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); margin-top: 6px; display: flex; justify-content: space-between; gap: 6px; }

.badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--hairline); color: var(--ink-dim); }

/* ---------- Folder / case cards ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 8px; }
.folder-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 18px;
  cursor: pointer;
  transition: border-color .15s ease, transform .1s ease;
  position: relative;
}
.folder-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.folder-card .folder-icon { font-size: 30px; margin-bottom: 12px; display: block; }
.folder-card .folder-name { font-size: 16px; font-weight: 600; font-family: var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card .folder-count { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-top: 6px; }
.folder-card .folder-desc { font-size: 12px; color: var(--ink-dim); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.folder-card .folder-del { position: absolute; top: 12px; right: 12px; opacity: 0; transition: opacity .15s ease; padding: 4px 8px; font-size: 11px; }
.folder-card:hover .folder-del { opacity: 1; }
.new-folder-card {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 20px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-dim);
  min-height: 118px;
  transition: border-color .15s ease, color .15s ease;
}
.new-folder-card:hover { border-color: var(--accent); color: var(--accent); }
.new-folder-card .plus { font-size: 28px; margin-bottom: 6px; }
.badge.hidden-badge { color: var(--danger); border-color: var(--danger); }
.badge.role-admin { color: var(--accent); border-color: var(--accent-dim); }

.empty-state { text-align: center; padding: 64px 20px; color: var(--ink-dim); font-family: var(--font-mono); font-size: 13px; border: 1px dashed var(--hairline); border-radius: var(--radius); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,9,13,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  padding: 26px;
}
.modal h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 4px; }
.modal .close-x { float: right; background: none; border: none; color: var(--ink-dim); font-size: 24px; cursor: pointer; padding: 0; }
.modal .preview-box { margin: 16px 0; border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.modal .preview-box img, .modal .preview-box video { width: 100%; max-height: 360px; object-fit: contain; display: block; }
.modal .preview-box iframe { width: 100%; height: 360px; border: none; }
.modal .detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.modal .detail-row .k { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.modal .actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Users table ---------- */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); padding: 13px 14px; border-bottom: 1px solid var(--hairline); }
.users-table td { padding: 13px 14px; border-bottom: 1px solid var(--hairline); font-size: 14px; vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.type-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.type-tags .badge { cursor: default; }

.checkbox-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.checkbox-grid label { display: flex; align-items: center; gap: 6px; text-transform: none; font-family: var(--font-body); font-size: 13px; color: var(--ink); cursor: pointer; }
.checkbox-grid input { width: auto; }

/* ---------- Subtabs (Files: Мої файли / Нотатки / Сховище файлів) ---------- */
.subtabs { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.subtabs button { font-family: var(--font-mono); font-size: 13px; padding: 9px 16px; }
.subtabs button.active { border-color: var(--accent); color: var(--accent); }

.users-table select { width: auto; padding: 7px 10px; font-size: 13px; }
.users-table .icon-btn { margin-right: 6px; }
.comment-cell { max-width: 220px; }
.comment-text { font-size: 13px; color: var(--ink-dim); word-break: break-word; margin-bottom: 6px; }

/* ---------- Мої файли: акуратна таблиця ---------- */
/* Горизонтальна прокрутка замість обрізання: у вузькій колонці остання
   кнопка дій інакше зникає за краєм картки. */
.table-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); overflow-x: auto; }
.table-card table { margin: 0; }
.table-card tbody tr:hover td { background: var(--panel-raised); }
#myfiles-table th, #myfiles-table td { text-align: center; }
#myfiles-table th:nth-child(2), #myfiles-table td:nth-child(2),
#myfiles-table th:nth-child(4), #myfiles-table td:nth-child(4) { text-align: left; }
.myfiles-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.myfiles-actions button { margin: 0; }

/* ---------- Notes ---------- */
.note-compose { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 28px; }
.note-compose-fields { display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: 100%; }
.note-compose-fields input[type=text] { width: 100%; }
.note-compose textarea { width: 100%; max-width: 100%; min-height: 64px; resize: vertical; font-size: 14px; }
.note-compose-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note-compose-actions select { width: auto; }
.notes-feed { display: flex; flex-direction: column; gap: 12px; }
.note-item { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.note-item .note-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.note-item .note-content { font-size: 14px; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }
.note-item .note-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-item .note-date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.note-item .note-actions { margin-left: auto; display: flex; gap: 8px; }
.badge.status-online { color: var(--ok); border-color: var(--ok); }
.badge.status-offline { color: var(--ink-dim); }

/* ---------- Чат ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 150px); border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; gap: 8px; max-width: 72%; position: relative; }
.chat-msg.own { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .bubble { background: var(--panel-raised); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 6px 10px; position: relative; }
.chat-msg.own .bubble { background: var(--accent-soft); border-color: var(--accent-dim); }
.chat-msg .sender { font-family: var(--font-mono); font-size: 10px; color: var(--accent); margin-bottom: 2px; }
.chat-msg .content { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.chat-msg .time { font-family: var(--font-mono); font-size: 9px; color: var(--ink-dim); margin-top: 2px; }
.chat-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--hairline); }
.chat-input-row input { flex: 1; padding: 8px 12px; }

.chat-msg .msg-toolbar { position: absolute; top: -22px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 6px; padding: 2px; z-index: 2; }
.chat-msg:hover .msg-toolbar { display: flex; }
.chat-msg.own .msg-toolbar { right: 0; }
.chat-msg:not(.own) .msg-toolbar { left: 0; }
.msg-toolbar button { padding: 2px 5px; font-size: 13px; line-height: 1; background: transparent; border: none; }
.msg-toolbar button:hover { background: var(--panel-raised); }

.chat-msg .reactions { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.reaction-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  border: 1px solid var(--hairline); background: var(--panel);
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
}
.reaction-chip.mine { border-color: var(--accent-dim); background: var(--accent-soft); color: var(--accent); }
.reaction-chip:hover { border-color: var(--accent-dim); }

.chat-online { font-family: var(--font-mono); font-size: 11px; color: var(--ok); }
.typing-indicator { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); min-height: 16px; padding: 2px 16px 6px; font-style: italic; }

/* ---------- Footer signature ---------- */
.sidebar-signature {
  text-align: center; margin-top: 14px; padding-top: 10px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em;
  color: var(--ink-dim); text-transform: uppercase;
}

/* ---------- Profile avatar upload ---------- */
.avatar-upload-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.avatar-upload-row .icon-btn { white-space: nowrap; }

/* ---------- Profile view ---------- */
.profile-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 28px; max-width: 460px; }
.profile-card .avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.color-swatches { display: flex; gap: 8px; margin-top: 6px; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-swatch.selected { border-color: var(--ink); }

/* ---------- Live indicator / toast ---------- */
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; box-shadow: 0 0 0 0 rgba(111,207,151,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111,207,151,.5);} 70% { box-shadow: 0 0 0 6px rgba(111,207,151,0);} 100% { box-shadow: 0 0 0 0 rgba(111,207,151,0);} }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--panel-raised); border: 1px solid var(--accent-dim); color: var(--ink); padding: 10px 16px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 12px; opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; pointer-events: none; z-index: 200; max-width: 320px; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Loading states ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--panel-raised) 25%, var(--panel) 50%, var(--panel-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text-sm { height: 10px; margin-bottom: 6px; width: 60%; }
.skeleton-thumb { height: 150px; width: 100%; }
.skeleton-avatar { width: 38px; height: 38px; border-radius: 50%; }
.skeleton-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}
.loading-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 14, 20, 0.7);
  z-index: 10;
}
.loading-row {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
}

.search-bar {
  display: flex; gap: 8px; margin-bottom: 20px; align-items: center;
}
.search-input {
  flex: 1; position: relative;
}
.search-input input {
  width: 100%; padding: 10px 12px 10px 36px;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  color: var(--ink); font-size: 14px;
}
.search-input input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-input::before {
  content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 14px; pointer-events: none;
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  font-size: 16px; padding: 4px; min-height: auto; min-width: auto;
}
.search-clear:hover { color: var(--ink); }
.search-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
  white-space: nowrap;
}

.confirm-overlay {
  position: fixed; inset: 0; background: rgba(6,9,13,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 20px;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 24px; max-width: 400px; width: 100%;
}
.confirm-box h3 {
  font-family: var(--font-display); font-size: 18px; margin: 0 0 12px;
  color: var(--ink);
}
.confirm-box p {
  font-size: 14px; color: var(--ink-dim); margin: 0 0 20px; line-height: 1.5;
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.confirm-actions button { min-width: 100px; }

.batch-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--panel); border-top: 1px solid var(--hairline);
  padding: 12px 20px; z-index: 100;
  align-items: center; gap: 12px; justify-content: space-between;
}
.batch-bar.visible { display: flex; }
.batch-count {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
}
.batch-actions { display: flex; gap: 8px; }
.file-card { position: relative; }
.file-select {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  width: 22px; height: 22px; cursor: pointer;
  accent-color: var(--accent);
}
.file-card.selected { border-color: var(--accent); background: var(--accent-soft); }

/* Light theme */
body.light {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-raised: #f0f2f5;
  --hairline: #e1e5ea;
  --ink: #1a2332;
  --ink-dim: #6b7a8d;
  --accent: #0d9488;
  --accent-dim: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.08);
  --ok: #16a34a;
  --danger: #dc2626;
}
body.light { background-image: none; }
body.light .login-card, body.light .sidebar, body.light .modal, body.light .profile-card,
body.light .note-item, body.light .chat-wrap, body.light .file-card, body.light .folder-card,
body.light .new-folder-card, body.light .table-card, body.light .confirm-box {
  background: var(--panel);
  border-color: var(--hairline);
}
body.light .skeleton {
  background: linear-gradient(90deg, #e1e5ea 25%, #f0f2f5 50%, #e1e5ea 75%);
  background-size: 200% 100%;
}
body.light .chat-msg .bubble { background: var(--panel-raised); border-color: var(--hairline); }
body.light .chat-msg.own .bubble { background: var(--accent-soft); border-color: var(--accent-dim); }
body.light .hamburger span { background: var(--ink); }
body.light .sidebar-overlay { background: rgba(0,0,0,0.3); }

.theme-toggle {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
}
.theme-toggle-label { cursor: pointer; }
.theme-switch {
  width: 40px; height: 22px; background: var(--hairline); border-radius: 11px;
  position: relative; cursor: pointer; transition: background 0.2s;
}
.theme-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink); transition: transform 0.2s;
}
body.light .theme-switch { background: var(--accent); }
body.light .theme-switch::after { transform: translateX(18px); background: #fff; }

/* ---------- Hamburger menu ---------- */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,9,13,0.6);
  z-index: 49;
}

@media (max-width: 860px) {
  .hamburger { display: flex; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .sidebar .owl-logo { border-bottom: 1px solid var(--hairline); margin-bottom: 20px; padding-bottom: 16px; }
  .sidebar-footer { display: block; margin-top: auto; border-top: 1px solid var(--hairline); padding-top: 16px; }
  .content { padding: 20px 16px; padding-top: 72px; max-width: 100%; }
  .page-head h1 { font-size: 24px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .modal { max-width: 100%; margin: 0; border-radius: 0; max-height: 100vh; height: 100vh; }
  .modal-overlay { padding: 0; }
  .chat-wrap { height: calc(100vh - 200px); }
  .chat-msg { max-width: 85%; }
  .users-table { font-size: 13px; }
  .users-table th, .users-table td { padding: 10px 8px; }
  .profile-card { max-width: 100%; }
}

@media (max-width: 600px) {
  .file-grid { grid-template-columns: 1fr; }
  .folder-grid { grid-template-columns: 1fr 1fr; }
  .filterbar { gap: 4px; }
  .filterbar button { padding: 8px 10px; font-size: 12px; }
  .subtabs { gap: 4px; }
  .subtabs button { padding: 8px 10px; font-size: 12px; }
  .note-compose { flex-direction: column; }
  .note-compose-fields { width: 100%; }
  .chat-input-row { padding: 8px; }
  .chat-input-row input { padding: 10px 12px; font-size: 16px; }
  .login-card { padding: 24px 20px; width: 100%; }
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-card table { min-width: 600px; }
}

@media (max-width: 860px) {
  button, .nav-item, .file-card, .folder-card, a { min-height: 44px; }
  input[type=text], input[type=password], textarea, select { min-height: 44px; font-size: 16px; }
}

/* Drag & drop */
.file-card.dragging { opacity: 0.4; }
.folder-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 4px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.new-folder-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 4px; }

/* =====================================================================
   Неоновий кіберкурсор
   ===================================================================== */
:root {
  --cursor-neon:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M4 2 L4 21 L9.2 16.4 L12.4 24 L16 22.4 L12.8 15 L20 14.6 Z' fill='%230b0f16' stroke='%234fd6c4' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M4 2 L4 21 L9.2 16.4 L12.4 24 L16 22.4 L12.8 15 L20 14.6 Z' fill='none' stroke='%23a8fff2' stroke-width='0.6' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto;
  --cursor-neon-pointer:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Ccircle cx='15' cy='15' r='9' fill='none' stroke='%234fd6c4' stroke-width='1.8'/%3E%3Ccircle cx='15' cy='15' r='2.4' fill='%23a8fff2'/%3E%3Cpath d='M15 1.5 L15 6 M15 24 L15 28.5 M1.5 15 L6 15 M24 15 L28.5 15' stroke='%234fd6c4' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 15 15, pointer;
}

body.neon-cursor { cursor: var(--cursor-neon); }
body.neon-cursor button,
body.neon-cursor a,
body.neon-cursor .nav-item,
body.neon-cursor .file-card,
body.neon-cursor .folder-card,
body.neon-cursor .new-folder-card,
body.neon-cursor .mini-profile,
body.neon-cursor .color-swatch,
body.neon-cursor .theme-switch,
body.neon-cursor summary,
body.neon-cursor select,
body.neon-cursor [role="button"] { cursor: var(--cursor-neon-pointer); }
body.neon-cursor input[type=text],
body.neon-cursor input[type=password],
body.neon-cursor input[type=number],
body.neon-cursor textarea { cursor: text; }

/* Світлий слід за курсором — окремий шар, подій не перехоплює. */
.cursor-glow {
  position: fixed; top: 0; left: 0;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 68%);
  box-shadow: 0 0 14px 2px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: opacity .25s ease, width .12s ease, height .12s ease;
  will-change: transform;
}
.cursor-glow.visible { opacity: .85; }
.cursor-glow.active { width: 40px; height: 40px; margin: -20px 0 0 -20px; }

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-glow { display: none; }
  body.neon-cursor { cursor: auto; }
  body.neon-cursor button, body.neon-cursor a, body.neon-cursor .nav-item { cursor: pointer; }
}

/* =====================================================================
   Логотип: шапка та фонова емблема
   ===================================================================== */
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; display: block; object-fit: contain; }
.owl-logo .brand-mark { border-radius: 4px; }
.login-card .brand-mark { width: 46px; height: 46px; }

/* Емблема на фоні сторінки — ледь помітна, під усім вмістом. */
.brand-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center 46%;
  background-size: min(58vw, 620px) auto;
  opacity: .05;
  filter: grayscale(1) brightness(1.7);
}
body.light .brand-backdrop { opacity: .04; filter: grayscale(1) brightness(0.4); }
.app, .login-wrap { position: relative; z-index: 1; }

/* =====================================================================
   Нижній колонтитул на всю сторінку
   ===================================================================== */
.page-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 18px 20px;
  border-top: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.page-footer strong { color: var(--accent); font-weight: 600; letter-spacing: .18em; }
.app { grid-template-rows: 1fr auto; }
.app .sidebar { grid-row: 1; }
.app .content { grid-row: 1; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
}

/* =====================================================================
   Файли: таблиця + бічна панель статистики
   ===================================================================== */
.files-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .files-layout { grid-template-columns: 1fr; } }

.stats-panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 20px;
}
.stats-panel h3 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.stat-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--hairline);
}
.stat-row:last-of-type { border-bottom: none; }
.stat-row .stat-label { font-size: 12.5px; color: var(--ink-dim); }
.stat-row .stat-value { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--ink); }
.stat-row .stat-value.accent { color: var(--accent); }
.stats-divider { height: 1px; background: var(--hairline); margin: 12px 0; }
.stats-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); line-height: 1.6; }
.stats-clock { font-family: var(--font-mono); font-size: 20px; color: var(--accent); letter-spacing: .06em; }

/* Шкала активності додавання файлів */
.activity-chart { display: flex; align-items: flex-end; gap: 3px; height: 62px; margin: 10px 0 6px; }
.activity-bar {
  flex: 1; min-width: 3px; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  min-height: 2px; opacity: .85; transition: opacity .15s ease;
}
.activity-bar:hover { opacity: 1; }
.activity-bar.empty { background: var(--hairline); opacity: .55; }
.activity-axis {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-dim);
}

/* =====================================================================
   Коментарі до архівів
   ===================================================================== */
/* Кнопки дій мають лишатись рядком: у вузькій колонці вони інакше
   складаються стовпчиком і рядок таблиці розтягується втричі. */
.platform-table { min-width: 680px; }
.platform-table th, .platform-table td { padding: 12px 10px; }
.platform-table td:last-child { min-width: 124px; }
.platform-table .myfiles-actions { flex-wrap: nowrap; justify-content: flex-start; gap: 5px; }
.platform-table .myfiles-actions button { padding: 7px 9px; line-height: 1; }
.platform-table .comment-cell { min-width: 180px; max-width: 260px; }

.comment-count-btn { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.comment-count-btn .count-pill {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-dim); border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center;
}
.comment-thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 42vh; overflow-y: auto; padding-right: 4px; }
.comment-item { display: flex; gap: 10px; }
.comment-body { flex: 1; background: var(--panel-raised); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 9px 12px; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-author { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 500; }
.comment-time { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); }
.comment-del { margin-left: auto; background: none; border: none; color: var(--ink-dim); font-size: 13px; padding: 0 4px; }
.comment-del:hover { color: var(--danger); }
.comment-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-empty { text-align: center; padding: 26px; color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; }
.comment-compose { border-top: 1px solid var(--hairline); padding-top: 14px; }
.comment-compose textarea { min-height: 76px; resize: vertical; margin-bottom: 10px; }
.comment-compose-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal.wide { max-width: 620px; }
.modal-subtitle { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-dim); margin: 0 0 4px; word-break: break-all; }

/* =====================================================================
   Панель активності учасників (вкладка «Користувачі»)
   ===================================================================== */
.users-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .users-layout { grid-template-columns: 1fr; } }

.presence-panel {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px; position: sticky; top: 20px;
}
.presence-panel h3 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 4px;
  display: flex; align-items: center; gap: 8px;
}
.presence-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); margin-bottom: 14px; }
.presence-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--hairline); }
.presence-item:last-child { border-bottom: none; }
.presence-info { flex: 1; min-width: 0; }
.presence-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--ok); }
.presence-meter { height: 4px; background: var(--hairline); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.presence-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 2px; }
.presence-empty { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; padding: 18px 0; text-align: center; }

/* =====================================================================
   Нотатки: мітки месенджерів
   ===================================================================== */
.messenger-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.messenger-chip {
  font-family: var(--font-mono); font-size: 12px; padding: 7px 13px;
  border: 1px solid var(--hairline); border-radius: 14px; background: var(--panel);
  display: inline-flex; align-items: center; gap: 6px;
}
.messenger-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.badge.messenger-badge { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-soft); }

/* =====================================================================
   Геолокація: міні-карта
   ===================================================================== */
.geo-layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 24px; }
@media (max-width: 900px) { .geo-layout { grid-template-columns: 1fr; } }

.map-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.map-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--hairline); background: var(--panel-raised);
}
.map-toolbar .map-readout { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); margin-left: auto; }
.map-toolbar button { padding: 7px 12px; font-family: var(--font-mono); font-size: 12px; }
.map-canvas { height: 320px; background: #060a10; position: relative; }
.map-canvas.tall { height: 520px; }
body.light .map-canvas { background: #dfe6ee; }
.map-hint {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--hairline); border-radius: 3px; padding: 4px 8px; pointer-events: none;
}

.geo-svg { width: 100%; height: 100%; display: block; touch-action: none; }
.geo-svg.dragging { cursor: grabbing; }
.geo-grid line { stroke: color-mix(in srgb, var(--accent) 14%, transparent); stroke-width: 0.5; }
.geo-country { fill: #10202b; stroke: #2b4250; stroke-width: 0.6; }
body.light .geo-country { fill: #c3ced9; stroke: #93a4b4; }
.geo-country.hl-home { fill: color-mix(in srgb, var(--accent) 26%, #10202b); stroke: var(--accent); stroke-width: 1.1; }
/* «Дарк»-заливка рф — навмисно темніша й холодніша за решту карти. */
.geo-country.hl-adversary { fill: #16090c; stroke: #6d1f2b; stroke-width: 1; }
body.light .geo-country.hl-adversary { fill: #4a3036; stroke: #7d3a46; }

.geo-marker-halo { fill: url(#geo-glow); }
.geo-marker-dot { fill: var(--accent); stroke: #04110e; stroke-width: 0.3; }
/* Обведення робить підпис читабельним поверх карти. Ширину задає JS у
   одиницях viewBox — у CSS фіксований px тут перетворився б на градуси. */
.geo-marker-label { fill: var(--ink); font-family: var(--font-mono); paint-order: stroke; stroke: #060a10; stroke-linejoin: round; }
body.light .geo-marker-label { stroke: #dfe6ee; }
.geo-marker-unit .geo-marker-dot { fill: #ff3b4e; }
.geo-marker-unit .geo-marker-halo { fill: #ff3b4e; opacity: .16; }
.geo-marker-target .geo-marker-dot { fill: #ffb020; }
.geo-marker-target .geo-marker-halo { fill: #ffb020; opacity: .16; }
.geo-marker-relay .geo-marker-dot { fill: var(--accent); }
.geo-marker-hq .geo-marker-dot { fill: #a888d1; }
.geo-marker-hq .geo-marker-halo { fill: #a888d1; opacity: .16; }

.geo-link { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: 1.2; }
.geo-link-flow {
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-dasharray: 5 22; stroke-linecap: round;
  animation: geo-flow 2.4s linear infinite;
}
@keyframes geo-flow { to { stroke-dashoffset: -54; } }
@media (prefers-reduced-motion: reduce) { .geo-link-flow { animation: none; } }
.geo-link-label { fill: var(--ink-dim); font-family: var(--font-mono); text-anchor: middle; paint-order: stroke; stroke: #060a10; stroke-linejoin: round; }
body.light .geo-link-label { stroke: #dfe6ee; }

.map-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.marker-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.marker-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
}
.marker-row .marker-name { font-size: 13.5px; font-weight: 500; }
.marker-row .marker-coords { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.marker-row .marker-actions { margin-left: auto; display: flex; gap: 6px; }

/* =====================================================================
   Підтримка
   ===================================================================== */
.support-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.support-card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.support-card .support-messenger {
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 9px;
}
.support-card .support-icon { font-size: 20px; }
.support-card .support-handle {
  font-family: var(--font-mono); font-size: 14px; color: var(--accent);
  word-break: break-all; background: var(--panel-raised);
  border: 1px solid var(--hairline); border-radius: 4px; padding: 8px 10px;
}
.support-card .support-note { font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.support-card .support-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.support-card .support-actions button, .support-card .support-actions .btn-link { white-space: nowrap; }

/* Посилання, оформлене як кнопка (вкладати <button> в <a> не можна). */
.btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-raised); color: var(--ink); text-decoration: none;
  border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 8px 10px; font-size: 14px; font-weight: 500; font-family: var(--font-body);
  transition: border-color .15s ease;
}
.btn-link:hover { border-color: var(--accent-dim); }

/* =====================================================================
   Сховище-обсідіан (дерево проєктів)
   ===================================================================== */
.vault-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .vault-layout { grid-template-columns: 1fr; } }

.vault-tree {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 12px; max-height: 72vh; overflow: auto;
}
.vault-node { user-select: none; }
.vault-branch > .vault-label { font-weight: 500; }
.vault-label {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px;
  border: 1px solid transparent;
}
.vault-label:hover { background: var(--panel-raised); }
.vault-label.selected { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }
.vault-caret { width: 12px; flex-shrink: 0; font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); transition: transform .15s ease; }
.vault-node.open > .vault-label .vault-caret { transform: rotate(90deg); }
.vault-icon { flex-shrink: 0; }
.vault-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-actions { display: none; gap: 3px; flex-shrink: 0; margin-left: 4px; }
.vault-label:hover .vault-actions, .vault-label.selected .vault-actions { display: inline-flex; }
.vault-mini { padding: 3px 7px; font-size: 12px; line-height: 1; min-height: auto; min-width: auto; }
.vault-badge { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); }
.vault-children { margin-left: 14px; padding-left: 8px; border-left: 1px dashed var(--hairline); display: none; }
.vault-node.open > .vault-children { display: block; }

.vault-preview {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 20px; min-height: 320px;
}
.vault-preview .vault-empty { color: var(--ink-dim); font-family: var(--font-mono); font-size: 13px; text-align: center; padding: 60px 20px; }
.vault-preview-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.vault-preview-head h3 { font-family: var(--font-display); font-size: 17px; margin: 0; word-break: break-word; }
.vault-preview-actions { margin-left: auto; display: flex; gap: 8px; }
.vault-media img, .vault-media video { width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--radius); background: var(--bg); }
.vault-media iframe { width: 100%; height: 440px; border: none; border-radius: var(--radius); background: var(--bg); }
.vault-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.vault-toolbar input[type=text] { flex: 1; min-width: 160px; }

/* =====================================================================
   Звіти (папки під паролем)
   ===================================================================== */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.report-card {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 7px; position: relative;
}
.report-card.locked { border-style: dashed; }
.report-card .report-lock { font-size: 24px; }
.report-card .report-name { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; word-break: break-word; }
.report-card .report-desc { font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.report-card .report-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); }
.report-card .report-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.report-card.unlocked { border-color: var(--accent-dim); }
.report-card.unlocked .report-lock { color: var(--ok); }

.key-field { display: flex; gap: 8px; align-items: stretch; }
.key-field input { flex: 1; font-family: var(--font-mono); font-size: 13px; }
.key-field button { white-space: nowrap; }
.key-warning {
  font-size: 12px; color: var(--danger); line-height: 1.5;
  border: 1px solid var(--danger); border-radius: var(--radius);
  padding: 10px 12px; margin: 12px 0;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.report-files { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.report-file-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel-raised); border: 1px solid var(--hairline); border-radius: var(--radius);
}
.report-file-row .rf-name { flex: 1; font-size: 13.5px; word-break: break-word; }
.report-file-row .rf-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim); white-space: nowrap; }

/* Спільне: сітка полів у формах на всю ширину */
.field-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; margin-bottom: 18px; }
.field-grid-3 .field { margin-bottom: 0; }
@media (max-width: 700px) { .field-grid-3 { grid-template-columns: 1fr; gap: 18px; } }
.wide-card { max-width: 760px; }
.bio-cell { max-width: 320px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.bio-cell .bio-more { color: var(--accent); cursor: pointer; font-family: var(--font-mono); font-size: 11px; }