:root {
  --accent: #3a7d44;
  --accent-hover: #316b3a;
  --accent-active: #295a31;
  --accent-light: #e8f2ea;
  --accent-soft: #cfe4d4;
  --accent-prodman: #538234;

  --text: #0e1812;
  --text-secondary: #2a3a30;
  --text-muted: #4a5c52;
  --text-on-accent: #ffffff;

  --bg-page: #e8eef0;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-panel: #ffffff;
  --bg-input: rgba(255, 255, 255, 0.86);
  --bg-subtle: #f4f7f5;
  --border: rgba(255, 255, 255, 0.5);
  --border-solid: #dce4df;
  --danger: #c62828;
  --danger-bg: #fdecec;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow-glass: 0 18px 48px rgba(11, 27, 16, 0.14);
  --shadow-sm: 0 4px 16px rgba(11, 27, 16, 0.08);
  --focus-ring: 0 0 0 3px rgba(58, 125, 68, 0.18);

  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --topbar-h: 56px;
  --shell-pad: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

body.is-auth {
  overflow: auto;
}

body.is-app {
  overflow: hidden;
}

button,
input {
  font-family: inherit;
}

a {
  color: var(--accent);
}

/* —— boot —— */
.app-boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(58, 125, 68, 0.22), transparent 55%),
    linear-gradient(160deg, #d5dde0 0%, #e8eef0 45%, #dfe8e2 100%);
}

.boot-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  animation: boot-pulse 1.1s ease-in-out infinite;
}

.boot-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

@keyframes boot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94); opacity: 0.75; }
}

.app-view {
  min-height: 100%;
  height: 100%;
}

/* —— auth atmosphere —— */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 15% 10%, rgba(58, 125, 68, 0.28), transparent 50%),
    radial-gradient(ellipse 70% 60% at 90% 80%, rgba(83, 130, 52, 0.18), transparent 45%),
    linear-gradient(165deg, #cfd8dc 0%, #e4ebe8 40%, #d2ddd6 100%);
}

.auth-page::before {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent 0 28px,
      rgba(14, 24, 18, 0.015) 28px 29px
    );
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 28px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  animation: card-in 0.35s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 14px rgba(58, 125, 68, 0.35));
}

.auth-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.auth-title span {
  color: var(--accent);
}

.auth-tagline {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .btn {
  width: 100%;
  margin-top: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field input::placeholder {
  color: #8a9a90;
  font-weight: 400;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: #fff;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-solid);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.drawer-actions .btn {
  min-width: 112px;
  height: 46px;
}

.auth-foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* —— app shell —— */
.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--shell-pad);
  gap: 12px;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(58, 125, 68, 0.12), transparent 50%),
    linear-gradient(165deg, #d5dde0 0%, #e8eef0 50%, #dde6e1 100%);
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 0 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.topbar-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.topbar-name span {
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  flex-shrink: 0;
  min-width: 0;
  max-width: 200px;
  line-height: 1.2;
}

.user-name {
  display: block;
  max-width: 100%;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-login {
  display: block;
  max-width: 100%;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bdbdbd;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(189, 189, 189, 0.25);
}

.ws-dot.is-on {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(58, 125, 68, 0.2);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn:hover {
  background: rgba(58, 125, 68, 0.08);
  color: var(--accent);
}

.nav-btn.is-active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.main-panel {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.main-panel--fill {
  align-items: stretch;
  justify-content: stretch;
}

.main-panel-inner {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.page-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #b71c1c;
}

/* —— section / users —— */
.section {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.55);
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid #e8e8e8;
  background: rgba(255, 255, 255, 0.65);
}

.section-toolbar-left,
.section-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-solid);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.search-wrap {
  position: relative;
}

.search-input {
  height: 36px;
  width: 200px;
  max-width: 42vw;
  padding: 0 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check-inline input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.section-banner {
  margin: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid #f0f0f0;
}

.section-banner--error {
  color: var(--danger);
  background: var(--danger-bg);
}

.table-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #666;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.data-table td {
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(250, 250, 250, 0.7);
}

.data-table tbody tr:hover {
  background: rgba(58, 125, 68, 0.1);
}

.data-table tbody tr.is-archived {
  opacity: 0.72;
}

.data-table .col-id {
  width: 64px;
}

.data-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: left;
}

.action-btns {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.icon-btn:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.icon-btn--danger {
  color: #a84848;
}

.icon-btn--danger:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #e8a0a0;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-danger-ghost {
  color: var(--danger);
  border-color: #f0c4c4;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #e8a0a0;
}

.data-table .strong {
  font-weight: 700;
}

.data-table .mono {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-root {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-user {
  background: #eef1f4;
  color: #55635a;
}

.badge-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-archive {
  background: #f5f5f5;
  color: #757575;
}

.badge-out {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-in {
  background: #e3f2fd;
  color: #1565c0;
}

.filter-select {
  height: 36px;
  min-width: 148px;
  max-width: 100%;
  padding: 0 28px 0 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.filter-select option {
  color: var(--text);
  font-weight: 500;
}

.search-input--wide {
  width: 220px;
}

.data-table--journal {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.data-table--journal th,
.data-table--journal td {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table--journal .col-actions {
  width: 1%;
  max-width: none;
  overflow: visible;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 4px 0 8px rgba(11, 27, 16, 0.04);
}

.data-table--journal thead .col-actions {
  z-index: 3;
  background: #f5f5f5;
}

.data-table--journal tbody tr:nth-child(even) .col-actions {
  background: #fafafa;
}

.data-table--journal tbody tr:hover .col-actions {
  background: #eef6f0;
}

.data-table--journal .col-our-ref {
  /* «ИСХ. №» + padding; номера короткие (p95≈9) */
  max-width: 14ch;
}

.data-table--journal .col-their-ref {
  max-width: 18ch;
}

.data-table--journal .col-date {
  /* «ДД.ММ.ГГГГ» (10) + padding ячейки (border-box) */
  max-width: 14ch;
}

.data-table--journal .col-dir {
  max-width: 12ch;
}

.data-table--journal .col-recipient {
  max-width: 28ch;
}

.data-table--journal .col-subject {
  max-width: 48ch;
}

.data-table--journal .col-enc {
  max-width: 10ch;
}

.data-table--journal .col-perf {
  max-width: 14ch;
}

.data-table--journal .col-method {
  max-width: 14ch;
}

.data-table--journal .col-comment {
  max-width: 22ch;
}

.data-table--journal .cell-trunc {
  display: block;
  max-width: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table--journal .col-our-ref .cell-trunc { max-width: 14ch; }
.data-table--journal .col-their-ref .cell-trunc { max-width: 18ch; }
.data-table--journal .col-date .cell-trunc { max-width: 14ch; }
.data-table--journal .col-recipient .cell-trunc { max-width: 28ch; }
.data-table--journal .col-subject .cell-trunc { max-width: 48ch; }
.data-table--journal .col-enc .cell-trunc { max-width: 10ch; }
.data-table--journal .col-perf .cell-trunc { max-width: 14ch; }
.data-table--journal .col-method .cell-trunc { max-width: 14ch; }
.data-table--journal .col-comment .cell-trunc { max-width: 22ch; }

/* Скан — без лимита, колонка тянется по содержимому */
.data-table--journal .col-link {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.data-table--journal .cell-copy {
  cursor: pointer;
}

.data-table--journal .cell-copy:hover {
  background: rgba(58, 125, 68, 0.08);
}

.data-table--journal .link-btn--scan {
  display: inline;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  vertical-align: baseline;
  text-align: left;
  padding: 0;
  font: inherit;
  font-weight: 700;
}

.cell-muted {
  color: var(--text-muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  height: 46px;
  padding: 0 14px;
}

.field-followup {
  margin-top: 8px;
}

.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.drawer--wide {
  width: min(520px, 100%);
}

.link-btn {
  border: none;
  background: none;
  padding: 0 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.col-actions .link-btn {
  margin-left: 4px;
}

.col-actions .link-btn:first-child {
  margin-left: 0;
}

.link-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.link-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.link-btn--danger {
  color: var(--danger);
}

.section-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
}

/* —— drawer —— */
.drawer-scrim,
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(14, 24, 18, 0.38);
  z-index: 20;
  animation: fade-in 0.12s ease;
}

.modal-scrim {
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  z-index: 30;
  background: #fff;
  border-left: 1px solid var(--border-solid);
  box-shadow: -12px 0 32px rgba(11, 27, 16, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawer-in 0.18s ease;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.icon-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.icon-close:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.drawer-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-form {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 0;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.drawer-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.drawer-tab:hover:not(:disabled) {
  color: var(--accent);
}

.drawer-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.drawer-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  width: 100%;
}

.field-with-btn input {
  flex: 1;
  min-width: 0;
}

.field-with-btn .btn {
  flex-shrink: 0;
  height: 46px;
  padding: 0 12px;
}

.field-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.field-static {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
}

.modal-card {
  width: 100%;
  max-width: min(400px, calc(100vw - 32px));
  padding: 22px 20px 18px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-glass);
  animation: card-in 0.2s ease;
  overflow: hidden;
}

.modal-card .drawer-actions {
  border-top: none;
  padding: 0;
  margin-top: 4px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
}

.modal-text {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  max-width: 420px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.empty-text {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
}

.toast-banner {
  margin: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border-bottom: 1px solid var(--accent-soft);
}

.col-dir .badge + .badge {
  margin-left: 4px;
}

@media (max-width: 900px) {
  .section-toolbar {
    align-items: flex-start;
  }

  .section-toolbar-right {
    width: 100%;
  }

  .search-input,
  .search-input--wide {
    width: 100%;
    max-width: none;
  }

  .filter-select {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 560px) {
  .shell {
    --shell-pad: 8px;
    gap: 8px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 28px 22px 22px;
  }

  .auth-title {
    font-size: 24px;
  }

  .user-name,
  .user-login {
    max-width: 100px;
  }

  .topbar-name {
    display: none;
  }

  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-input {
    width: 140px;
  }

  .data-table .col-actions {
    width: auto;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .auth-card,
  .topbar,
  .main-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #ffffff;
  }
}
