:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #6b7280;
  --line: #d7dde5;
  --accent: #1f6feb;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111827;
  color: white;
  padding: 12px 24px;
}

.topbar a { color: white; text-decoration: none; margin-left: 16px; }
.topbar .brand { margin-left: 0; font-weight: 700; font-size: 18px; }

.container {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 20px;
}

h1, h2 { margin: 0 0 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef2f7;
  font-size: 13px;
}

tr:last-child td { border-bottom: 0; }

.search {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.search input {
  flex: 1;
}

input, select, textarea, button, .button {
  font: inherit;
  border-radius: 8px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: white;
}

textarea {
  min-height: 90px;
}

button, .button {
  display: inline-block;
  border: 0;
  background: var(--accent);
  color: white;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
}

.button.secondary {
  background: #64748b;
}

button.link {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

button.danger, .danger {
  color: var(--danger) !important;
}

.form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

.form.narrow {
  max-width: 420px;
}

.form label {
  display: block;
  font-weight: 700;
  margin: 10px 0 6px;
}

.form .check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}

.form .check input {
  width: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  align-items: center;
}

.row-actions {
  white-space: nowrap;
}

.row-actions form {
  display: inline;
  margin-left: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.tabs a {
  padding: 10px 14px;
  border-radius: 8px;
  background: #dbe3ee;
  color: #111827;
  text-decoration: none;
}

.tabs a.active {
  background: var(--accent);
  color: white;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted, .hint {
  color: var(--muted);
}

.hint {
  margin-top: 14px;
}

.error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

code {
  background: #e5e7eb;
  padding: 2px 5px;
  border-radius: 5px;
}

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { display: block; }
  .topbar nav { margin-top: 10px; }
  .topbar a { display: inline-block; margin: 4px 8px 4px 0; }
}

.pad {
  padding: 18px;
}

.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.sim-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.sim-tabs a {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: #dbe3ee;
  color: #111827;
  text-decoration: none;
  font-weight: 700;
}

.sim-tabs a.active {
  background: var(--accent);
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.stat-card.secondary {
  background: #f8fafc;
}

.stat-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-main {
  font-size: 24px;
  font-weight: 800;
}

.stat-sub {
  margin-top: 4px;
  color: #334155;
}

.sortlink {
  color: inherit;
  text-decoration: none;
}

.sortlink:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  font-weight: 700;
  font-size: 12px;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Pretty SIM cards page */
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.page-title {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 5px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pretty-tabs {
  background: #eaf0f7;
  border: 1px solid #d8e1ec;
  border-radius: 14px;
  padding: 6px;
  width: fit-content;
}

.pretty-tabs a {
  border-radius: 10px;
  background: transparent;
  color: #334155;
  box-shadow: none;
}

.pretty-tabs a.active {
  background: #1f6feb;
  color: white;
  box-shadow: 0 6px 16px rgba(31, 111, 235, .22);
}

.pretty-stats {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.pretty-stats .stat-card {
  border: 1px solid #d9e3ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.pretty-stats .stat-primary {
  background: linear-gradient(135deg, #1f6feb 0%, #0f4fb8 100%);
  color: white;
  border-color: #1f6feb;
}

.pretty-stats .stat-primary .stat-title,
.pretty-stats .stat-primary .stat-sub {
  color: rgba(255,255,255,.82);
}

.stat-money {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 800;
}

.filter-panel {
  background: white;
  border: 1px solid #d9e3ef;
  border-radius: 14px;
  padding: 14px;
  margin: 0 0 16px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}

.pretty-search {
  margin: 0;
}

.pretty-search input {
  min-height: 42px;
  border-radius: 10px;
}

.button.ghost {
  background: #eef2f7;
  color: #334155;
}

.pretty-table-card {
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
}

.pretty-table {
  font-size: 14px;
}

.pretty-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.pretty-table td {
  vertical-align: middle;
}

.pretty-table tbody tr:hover {
  background: #f8fbff;
}

.sort-arrow {
  margin-left: 4px;
  font-size: 10px;
  color: #1f6feb;
}

.right {
  text-align: right;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.strong {
  font-weight: 800;
}

.category-badge {
  min-width: 46px;
  text-align: center;
}

.category-badge.it {
  background: #dbeafe;
  color: #1e3a8a;
}

.category-badge.itso {
  background: #fef3c7;
  color: #92400e;
}

.status-pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.status-активна {
  background: #dcfce7;
  color: #166534;
}

.status-на-складе {
  background: #e0f2fe;
  color: #075985;
}

.status-выдана {
  background: #ede9fe;
  color: #5b21b6;
}

.status-заблокирована,
.status-утеряна,
.status-отключена {
  background: #fee2e2;
  color: #991b1b;
}

.person-main {
  font-weight: 700;
}

.person-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.actions-col {
  white-space: nowrap;
}

.mini-link {
  font-size: 13px;
  font-weight: 700;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 26px !important;
}

@media (max-width: 1050px) {
  .page-title-row {
    display: block;
  }

  .page-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .pretty-stats {
    grid-template-columns: 1fr;
  }
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
}

.import-grid h3 {
  margin-top: 0;
}

@media (max-width: 900px) {
  .import-grid {
    grid-template-columns: 1fr;
  }
}

.pc-specs {
  max-width: 340px;
  white-space: normal;
}

.password-mask {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.mini-btn {
  margin-left: 6px;
  border: 0;
  background: #e5e7eb;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  font-weight: 700;
}

.mini-btn:hover {
  background: #d1d5db;
}

.status-в-работе {
  background: #dcfce7;
  color: #166534;
}

.status-резерв {
  background: #e0f2fe;
  color: #075985;
}

.status-ремонт {
  background: #fef3c7;
  color: #92400e;
}

.status-списан {
  background: #fee2e2;
  color: #991b1b;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 8px;
  margin: 8px 0 16px;
}

.perm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  font-size: 12px;
  margin: 2px;
}

@media (max-width: 900px) {
  .perm-grid {
    grid-template-columns: 1fr;
  }
}

.permissions-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0 18px;
  background: #fff;
}

.perm-row {
  display: grid;
  grid-template-columns: 240px 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.perm-row:last-child {
  border-bottom: 0;
}

.perm-head {
  background: #eef2f7;
  font-weight: 800;
}

.perm-row label {
  margin: 0;
  font-weight: 600;
}

.perm-badge.edit {
  background: #dcfce7;
  color: #166534;
}

@media (max-width: 800px) {
  .perm-row {
    grid-template-columns: 1fr;
  }
}

/* Top black header admin dropdown */
.topbar {
  overflow: visible;
}

.topnav {
  overflow: visible;
}

.top-admin-dropdown {
  position: relative;
  display: inline-block;
}

.top-admin-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #fff;
  padding: 0;
  user-select: none;
}

.top-admin-dropdown summary::-webkit-details-marker {
  display: none;
}

.top-admin-dropdown summary::after {
  content: " ▾";
  font-size: 12px;
}

.top-admin-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 14px);
  z-index: 100;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .25);
  padding: 8px;
}

.top-admin-menu a {
  display: block;
  color: #111827 !important;
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.top-admin-menu a:hover {
  background: #eef2f7;
}

@media (max-width: 700px) {
  .top-admin-menu {
    right: auto;
    left: 0;
  }
}

.perm-row {
  grid-template-columns: 240px 1fr 1fr 1fr;
}

.perm-badge.comment {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 800px) {
  .perm-row {
    grid-template-columns: 1fr;
  }
}

/* PC actions dropdown */
.actions-col {
  position: relative;
  white-space: nowrap;
}

.actions-menu {
  position: relative;
  display: inline-block;
}

.actions-menu summary {
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  font-weight: 600;
  list-style: none;
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu summary::after {
  content: " ▾";
  color: #64748b;
}

.actions-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 999;
  min-width: 170px;
  padding: 6px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.actions-menu-item,
.actions-menu-muted {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #1e40af;
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
}

.actions-menu-item:hover {
  background: #eff6ff;
  text-decoration: none;
}

.actions-menu-muted {
  color: #64748b;
  font-weight: 500;
}

.actions-menu-form {
  margin: 0;
}

.actions-menu-danger {
  color: #b91c1c;
  cursor: pointer;
}

.actions-menu-danger:hover {
  background: #fef2f2;
}

.pretty-table-card {
  overflow: visible;
}


/* RustDesk remote install */
.pc-install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 18px;
  margin-top: 10px;
}

.install-log {
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 520px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.45;
}

.ok-text {
  color: #4ade80;
}

.danger-text {
  color: #f87171;
}


/* PC actions dropdown popup fix v2 */
.actions-col {
  overflow: visible;
}

.actions-menu {
  position: relative;
  display: inline-block;
  z-index: 20;
}

.actions-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 98px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu summary::after {
  content: "▼";
  font-size: 10px;
  color: #64748b;
}

.actions-menu[open] summary {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.actions-menu-list {
  display: none;
}

.actions-menu[open] .actions-menu-list {
  position: fixed !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  min-width: 190px;
  max-width: 260px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
  z-index: 99999;
}

.actions-menu-item,
.actions-menu-muted {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #1d4ed8;
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.actions-menu-item:hover {
  background: #eff6ff;
  color: #1e40af;
}

.actions-menu-muted {
  color: #94a3b8;
  cursor: default;
}

.actions-menu-form {
  margin: 0;
  padding: 0;
}

.actions-menu-danger {
  color: #b91c1c;
  cursor: pointer;
}

.actions-menu-danger:hover {
  background: #fef2f2;
  color: #991b1b;
}


/* PC actions dropdown portal fix v3 */
details.actions-menu > .actions-menu-list {
  display: none !important;
}

.actions-menu summary {
  position: relative;
  z-index: 1 !important;
}

.actions-menu summary.actions-summary-active {
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
  background: #eff6ff !important;
}

.pc-actions-portal {
  position: fixed !important;
  z-index: 2147483000 !important;
  min-width: 190px;
  max-width: 260px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
}

.pc-actions-portal[hidden] {
  display: none !important;
}

.pc-actions-portal .actions-menu-item,
.pc-actions-portal .actions-menu-muted {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e40af;
  text-align: left;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.pc-actions-portal .actions-menu-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.pc-actions-portal .actions-menu-muted {
  color: #64748b;
  cursor: default;
}

.pc-actions-portal .actions-menu-form {
  margin: 0;
  padding: 0;
}

.pc-actions-portal .actions-menu-danger {
  color: #b91c1c !important;
}

.pc-actions-portal .actions-menu-danger:hover {
  background: #fef2f2 !important;
  color: #991b1b !important;
}

.rustdesk-link {
  color: #0f766e;
}

.rustdesk-card {
  margin-bottom: 16px;
}

.rustdesk-reach {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.logbox {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
}

.small-log {
  max-height: 180px;
}

.warning {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
  font-weight: 700;
}

.compact-table td,
.compact-table th {
  padding: 8px 10px;
}

.rustdesk-log-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}


/* RustDesk install live console v1 */
.rustdesk-install-console-wrap {
  margin-top: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  overflow: hidden;
}

.rustdesk-install-console-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  color: #e5e7eb;
}

.rustdesk-install-console-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #93c5fd;
  white-space: nowrap;
}

.rustdesk-install-console {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: #d1fae5;
  background: #020617;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* === PUBLIC PRINT DIRECTORY START === */
.directory-page {
  max-width: 1600px;
  margin: 0 auto;
}

.directory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.directory-toolbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.directory-subtitle {
  color: #64748b;
  font-size: 17px;
  margin-top: 6px;
}

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

.directory-actions button,
.directory-filter button {
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  padding: 11px 18px;
  font-weight: 800;
  cursor: pointer;
}

.directory-filter {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 280px auto auto;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.directory-filter input,
.directory-filter select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fff;
}

.directory-summary {
  color: #64748b;
  margin: 8px 0 18px;
}

.directory-section {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

.department-title {
  background: #e5e7eb;
  color: #111827;
  font-size: 20px;
  font-weight: 900;
  padding: 12px 16px;
  border-bottom: 2px solid #94a3b8;
  letter-spacing: .2px;
}

.directory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: #111827;
}

.directory-table th {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 9px 8px;
  text-align: left;
  font-weight: 900;
}

.directory-table td {
  border: 1px solid #d8e1ec;
  padding: 8px;
  vertical-align: top;
}

.directory-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.col-num {
  width: 46px;
  text-align: center !important;
}

.employee-cell {
  font-weight: 900;
  min-width: 190px;
}

.phone-cell,
.internal-cell {
  font-weight: 900;
  white-space: nowrap;
}

.phone-online,
.phone-offline,
.phone-unknown {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.phone-online {
  background: #dcfce7;
  color: #166534;
}

.phone-offline {
  background: #fee2e2;
  color: #991b1b;
}

.phone-unknown {
  background: #fef3c7;
  color: #92400e;
}

.directory-empty {
  background: #fff;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  padding: 24px;
  color: #64748b;
}

.print-only {
  display: none;
}

@media (max-width: 1000px) {
  .directory-toolbar {
    display: block;
  }

  .directory-actions {
    margin-top: 12px;
  }

  .directory-filter {
    grid-template-columns: 1fr;
  }

  .directory-section {
    overflow-x: auto;
  }

  .directory-table {
    min-width: 1250px;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .topbar,
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .container {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .directory-page {
    max-width: none;
  }

  .directory-print-head {
    margin-bottom: 12px;
    text-align: center;
  }

  .directory-print-head h1 {
    margin: 0 0 4px;
    font-size: 22px;
  }

  .directory-section {
    box-shadow: none;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 14px;
  }

  .department-title {
    font-size: 16px;
    padding: 7px 9px;
  }

  .directory-table {
    font-size: 10px;
  }

  .directory-table th,
  .directory-table td {
    padding: 4px 5px;
    border-color: #444;
  }

  .phone-online,
  .phone-offline,
  .phone-unknown {
    border: 1px solid #555;
    background: #fff !important;
    color: #000 !important;
    padding: 1px 4px;
  }
}
/* === PUBLIC PRINT DIRECTORY END === */

/* === CONTACTS BULK DEPARTMENT START === */
.contacts-admin-layout {
  display: grid;
  gap: 16px;
}

.contacts-filter-panel {
  display: grid;
  gap: 12px;
}

.contacts-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 260px auto auto;
  gap: 10px;
  align-items: center;
}

.contacts-search select,
.contacts-bulk-panel select,
.contacts-bulk-panel input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
}

.department-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8eef7;
  color: #1f2937;
  text-decoration: none;
  padding: 8px 12px;
  font-weight: 800;
}

.dept-chip.active {
  background: #2563eb;
  color: #fff;
}

.contacts-bulk-panel {
  display: grid;
  grid-template-columns: auto 260px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #d8e1ec;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.bulk-title {
  font-weight: 900;
}

.contacts-bulk-panel button {
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  padding: 11px 18px;
  font-weight: 900;
  cursor: pointer;
}

.contacts-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  padding: 6px 10px;
  font-size: 13px;
}

.check-col {
  width: 42px;
  text-align: center !important;
}

.dept-label {
  display: inline-flex;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 4px 8px;
  font-weight: 800;
  white-space: nowrap;
}

.dept-label.empty {
  background: #fee2e2;
  color: #991b1b;
}

.admin-contacts-bulk-table td,
.admin-contacts-bulk-table th {
  vertical-align: middle;
}

@media (max-width: 1000px) {
  .contacts-search,
  .contacts-bulk-panel {
    grid-template-columns: 1fr;
  }
}
/* === CONTACTS BULK DEPARTMENT END === */

/* Departments admin */
.department-add-form {
  margin-bottom: 16px;
}

/* Phone status admin */
.phone-status-admin-box {
  background: #f8fafc;
  border: 1px solid #d8e1ec;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.phone-status-info {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

.phone-check-single-form {
  margin-top: 12px;
}

.phone-check-single-form button {
  border: 0;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  padding: 11px 18px;
  font-weight: 900;
  cursor: pointer;
}

/* === EXCEL PUBLIC DIRECTORY START === */
.print-directory-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.print-directory-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.print-directory-toolbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  color: #111827;
}

.directory-subtitle {
  margin-top: 6px;
  font-size: 16px;
  color: #64748b;
}

.print-button {
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  padding: 12px 22px;
  font-weight: 900;
  cursor: pointer;
}

.directory-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 320px auto auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.directory-search input,
.directory-search select {
  border: 1px solid #b6c3d5;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
}

.directory-search button {
  border: 0;
  border-radius: 9px;
  background: #2563eb;
  color: #fff;
  padding: 11px 18px;
  font-weight: 900;
  cursor: pointer;
}

.directory-found {
  color: #475569;
  margin: 10px 0 16px;
}

.excel-department-block {
  margin: 0 0 22px;
  page-break-inside: avoid;
}

.excel-directory-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  border: 2px solid #111;
  font-size: 14px;
  color: #111827;
}

.excel-directory-table th,
.excel-directory-table td {
  border: 1px solid #111;
  padding: 6px 8px;
  vertical-align: middle;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: anywhere;
}

.excel-department-row th {
  background: #f4cccc;
  color: #111;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  padding: 8px;
  border: 2px solid #111;
}

.excel-header-row th {
  background: #f4cccc;
  color: #111;
  text-align: center;
  font-weight: 900;
}

.excel-num-col {
  width: 44px;
}

.excel-name-col {
  width: 230px;
}

.excel-position-col {
  width: 260px;
}

.excel-work-phone-col {
  width: 150px;
}

.excel-extension-col {
  width: 110px;
}

.excel-email-col {
  width: 170px;
}

.excel-status-col {
  width: 125px;
}

.excel-comment-col {
  width: 250px;
}

.excel-num-cell {
  background: #fff2cc;
  text-align: center;
  font-weight: 700;
}

.excel-name-cell {
  font-weight: 700;
}

.excel-extension-cell {
  text-align: center;
  font-weight: 900;
}

.excel-status-cell {
  text-align: center;
}

.excel-phone-status {
  display: inline-block;
  min-width: 82px;
  border-radius: 0;
  border: 1px solid #111;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 900;
  color: #111;
}

.excel-phone-online {
  background: #d9ead3;
}

.excel-phone-offline {
  background: #f4cccc;
}

.excel-phone-unknown {
  background: #fff2cc;
}

.empty-directory {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 22px;
  color: #64748b;
}

.print-only {
  display: none;
}

@media (max-width: 1100px) {
  .directory-search {
    grid-template-columns: 1fr;
  }

  .excel-directory-table {
    font-size: 12px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .no-print,
  header,
  nav,
  .topbar,
  .navbar,
  .main-nav {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .print-directory-page {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .excel-print-title {
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 6px;
  }

  .excel-department-block {
    margin-bottom: 8px;
    page-break-inside: avoid;
  }

  .excel-directory-table {
    font-size: 9px;
    border: 1.4px solid #000;
  }

  .excel-directory-table th,
  .excel-directory-table td {
    border: 1px solid #000;
    padding: 3px 4px;
  }

  .excel-department-row th {
    font-size: 12px;
    padding: 4px;
    border: 1.4px solid #000;
  }

  .excel-phone-status {
    min-width: 56px;
    font-size: 8px;
    padding: 1px 3px;
  }
}
/* === EXCEL PUBLIC DIRECTORY END === */

/* === PHONE STATUS DOT START === */
.excel-status-col {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  text-align: center !important;
}

.excel-status-cell {
  text-align: center !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
}

.excel-phone-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid #111;
  vertical-align: middle;
}

.excel-phone-dot.excel-phone-online {
  background: #00a651;
}

.excel-phone-dot.excel-phone-offline {
  background: #d60000;
}

.excel-phone-dot.excel-phone-unknown {
  background: #ffd966;
}

@media print {
  .excel-status-col {
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
  }

  .excel-phone-dot {
    width: 7px;
    height: 7px;
    border: 0.7px solid #000;
  }
}
/* === PHONE STATUS DOT END === */

/* === HARD NARROW PHONE DOT COLUMN START === */
.excel-directory-table .col-num { width: 42px; }
.excel-directory-table .col-name { width: 190px; }
.excel-directory-table .col-position { width: 190px; }
.excel-directory-table .col-work-phone { width: 150px; }
.excel-directory-table .col-extension { width: 120px; }
.excel-directory-table .col-email { width: 160px; }
.excel-directory-table .col-status-dot { width: 26px !important; }
.excel-directory-table .col-comment { width: auto; }

.excel-status-col,
.excel-status-cell {
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  text-align: center !important;
}

.excel-phone-dot {
  width: 10px !important;
  height: 10px !important;
}

@media print {
  .excel-directory-table .col-status-dot {
    width: 18px !important;
  }

  .excel-status-col,
  .excel-status-cell {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
  }

  .excel-phone-dot {
    width: 6px !important;
    height: 6px !important;
  }
}
/* === HARD NARROW PHONE DOT COLUMN END === */

/* === NARROW COMMENT COLUMN START === */
.excel-directory-table .col-name {
  width: 215px !important;
}

.excel-directory-table .col-position {
  width: 230px !important;
}

.excel-directory-table .col-work-phone {
  width: 145px !important;
}

.excel-directory-table .col-extension {
  width: 110px !important;
}

.excel-directory-table .col-email {
  width: 155px !important;
}

.excel-directory-table .col-status-dot {
  width: 24px !important;
}

.excel-directory-table .col-comment {
  width: 115px !important;
}

.excel-comment-col {
  width: 115px !important;
  min-width: 115px !important;
  max-width: 115px !important;
}

.excel-directory-table td:last-child {
  width: 115px !important;
  min-width: 115px !important;
  max-width: 115px !important;
  font-size: 13px;
  line-height: 1.15;
}

@media print {
  .excel-directory-table .col-comment,
  .excel-comment-col,
  .excel-directory-table td:last-child {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    font-size: 8px;
  }
}
/* === NARROW COMMENT COLUMN END === */

/* === SKUD MODULE START === */
.skud-stats .stat-card {
  min-width: 140px;
}

.skud-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: rgba(15, 23, 42, .06);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.skud-form .inline-generator {
  display: flex;
  gap: 8px;
  align-items: center;
}

.skud-form .inline-generator input {
  flex: 1;
}

.skud-form .inline-generator .button {
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
  white-space: nowrap;
}

.skud-status-Активна,
.skud-status-Выдана {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.skud-status-Заблокирована,
.skud-status-Утеряна {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.skud-status-Возвращена {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
/* === SKUD MODULE END === */

/* === SKUD AUTO NUMBER START === */
.skud-form .readonly-input {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: not-allowed;
}
/* === SKUD AUTO NUMBER END === */

/* === SKUD RELEASED POOL START === */
.stat-card.stat-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}
.stat-card.stat-warning .stat-main {
  color: #c2410c;
}
/* === SKUD RELEASED POOL END === */

/* === RESTORED SKUD CSS START === */
.skud-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: rgba(15, 23, 42, .06);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.skud-form .readonly-input {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: not-allowed;
}

.stat-card.stat-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}

.stat-card.stat-warning .stat-main {
  color: #c2410c;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
  white-space: nowrap;
}
/* === RESTORED SKUD CSS END === */

/* ===== Unified Admin UI safe v2 ===== */
:root {
  --ui-bg: #f3f6fb;
  --ui-card: #ffffff;
  --ui-card-soft: #f8fbff;
  --ui-border: #d8e3f2;
  --ui-border-strong: #c8d7eb;
  --ui-text: #172033;
  --ui-muted: #66758c;
  --ui-blue: #2563eb;
  --ui-blue-dark: #1d4ed8;
  --ui-blue-soft: #e8f0ff;
  --ui-green: #15803d;
  --ui-green-soft: #dcfce7;
  --ui-red: #b91c1c;
  --ui-red-soft: #fee2e2;
  --ui-yellow: #a16207;
  --ui-yellow-soft: #fef3c7;
  --ui-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  --ui-radius: 14px;
}

body {
  background: linear-gradient(180deg, #f7faff 0%, var(--ui-bg) 100%);
  color: var(--ui-text);
}

h1, h2, h3 {
  letter-spacing: -0.02em;
}

.muted,
.help,
small {
  color: var(--ui-muted);
}

/* Верхнее меню */
.admin-nav,
.nav,
.tabs,
.subnav,
.page-actions,
.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.admin-nav a,
.nav a,
.tabs a,
.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #dfe8f5;
  color: #1f2937;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
}

.admin-nav a:hover,
.nav a:hover,
.tabs a:hover,
.subnav a:hover {
  background: #d5e2f2;
}

.admin-nav a.active,
.nav a.active,
.tabs a.active,
.subnav a.active,
a.active {
  background: var(--ui-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .20);
}

/* Кнопки */
.button,
button,
input[type="submit"] {
  border-radius: 10px;
  font-weight: 650;
  border: 1px solid transparent;
}

.button.primary,
button.primary,
input[type="submit"] {
  background: var(--ui-blue);
  color: #fff;
}

.button.primary:hover,
button.primary:hover,
input[type="submit"]:hover {
  background: var(--ui-blue-dark);
}

.button.secondary,
button.secondary {
  background: #e4edf8;
  color: #1f2937;
}

.button.danger,
button.danger {
  background: var(--ui-blue);
  color: #fff;
}

/* Формы: не трогаем чекбоксы */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border: 1px solid var(--ui-border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ui-text);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7aa7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* Нормальный размер чекбоксов */
input[type="checkbox"],
input[type="radio"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  padding: 0 !important;
  margin: 0 8px 0 0 !important;
  vertical-align: middle !important;
  box-shadow: none !important;
  transform: none !important;
  accent-color: var(--ui-blue);
}

/* Таблицы без распухания */
table {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  overflow: hidden;
  box-shadow: var(--ui-shadow);
}

th {
  background: #e9f0f8;
  color: #111827;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

td,
th {
  padding: 10px 12px;
  vertical-align: middle;
}

tbody tr:nth-child(even) td {
  background: rgba(219, 234, 254, .32);
}

tbody tr:hover td {
  background: rgba(219, 234, 254, .55);
}

/* Бейджи */
.badge,
.status-ok,
.status-error,
.status-warn,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.status-ok,
.badge-ok {
  background: var(--ui-green-soft);
  color: var(--ui-green);
}

.status-error,
.badge-error {
  background: var(--ui-red-soft);
  color: var(--ui-red);
}

.status-warn,
.badge-warn {
  background: var(--ui-yellow-soft);
  color: var(--ui-yellow);
}

/* Пользователи: компактнее */
.admin-users table,
.users table {
  font-size: 14px;
}

.admin-users td,
.admin-users th {
  vertical-align: top;
}

/* Форма пользователя */
.user-form table input[type="checkbox"],
form table input[type="checkbox"] {
  display: inline-block !important;
}

.user-form table label,
form table label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

/* СКУД */
.terminal-panel,
.skud-panel,
.skud-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
}

.terminal-check {
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: #fff;
}

.terminal-check:hover {
  border-color: #8bb7ff;
}

/* ===== Users UI clean cards v1 ===== */
.page-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 16px 0;
}

.page-bar h2 {
  margin: 0 0 6px 0;
}

.users-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.summary-card {
  background: #fff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.summary-label {
  display: block;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
}

.summary-card strong {
  font-size: 26px;
}

.users-list {
  display: grid;
  gap: 12px;
}

.user-card {
  background: #fff;
  border: 1px solid #d8e3f2;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.user-card-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.user-login {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 7px;
}

.user-meta,
.user-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.perm-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2ff;
  color: #3730a3;
}

.perm-badge.edit {
  background: #dcfce7;
  color: #166534;
}

.perm-badge.extra {
  background: #fef3c7;
  color: #92400e;
}

.perm-badge.skud {
  background: #dbeafe;
  color: #1d4ed8;
}

.perm-badge.skud-edit {
  background: #ccfbf1;
  color: #0f766e;
}

.perm-badge.all {
  background: #fef3c7;
  color: #92400e;
}

.user-editor-card {
  background: #fff;
  border: 1px solid #d8e3f2;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  padding: 18px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
}

.form-field input {
  width: 100%;
}

.user-status-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.nice-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  background: #f8fbff;
  padding: 13px;
}

.nice-check small {
  display: block;
  margin-top: 3px;
}

.section-title {
  margin: 20px 0 10px 0;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 10px 0 16px 0;
}

.perm-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.perm-card {
  border: 1px solid #d8e3f2;
  border-radius: 16px;
  background: #f8fbff;
  padding: 15px;
}

.perm-card.skud-card {
  border-color: #93c5fd;
  background: #eff6ff;
}

.perm-title {
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 5px;
}

.perm-card p {
  margin: 0 0 12px 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.perm-card label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0;
  font-weight: 750;
}

.form-actions-sticky {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 760px) {
  .page-bar,
  .user-card-main {
    flex-direction: column;
  }

  .user-actions {
    width: 100%;
  }
}

/* ===== Primary button contrast fix ===== */
a.button.primary,
a.button.primary:link,
a.button.primary:visited,
button.primary,
input[type="submit"],
.primary.button {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  text-decoration: none !important;
}

a.button.primary:hover,
button.primary:hover,
input[type="submit"]:hover,
.primary.button:hover {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
}

a.button.primary *,
button.primary *,
.primary.button * {
  color: #ffffff !important;
}

a.button.secondary,
a.button.secondary:link,
a.button.secondary:visited,
button.secondary,
.secondary.button {
  color: #1f2937 !important;
  text-decoration: none !important;
}

/* ===== Default button link contrast fix ===== */
a.button:not(.secondary):not(.ghost),
a.button:not(.secondary):not(.ghost):link,
a.button:not(.secondary):not(.ghost):visited,
button.button:not(.secondary):not(.ghost),
.button.primary,
.button.primary:link,
.button.primary:visited {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  text-decoration: none !important;
}

a.button:not(.secondary):not(.ghost):hover,
button.button:not(.secondary):not(.ghost):hover,
.button.primary:hover {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
}

a.button:not(.secondary):not(.ghost) *,
button.button:not(.secondary):not(.ghost) *,
.button.primary * {
  color: #ffffff !important;
}

a.button.secondary,
a.button.secondary:link,
a.button.secondary:visited,
button.button.secondary,
.button.secondary {
  background: #e4edf8 !important;
  color: #1f2937 !important;
  border-color: #d8e3f2 !important;
  text-decoration: none !important;
}

a.button.ghost,
a.button.ghost:link,
a.button.ghost:visited,
button.button.ghost,
.button.ghost {
  background: transparent !important;
  color: #1f2937 !important;
  border-color: #d8e3f2 !important;
  text-decoration: none !important;
}
/* ===== Light theme only cleanup ===== */
html,
body {
  color-scheme: light !important;
}

.theme-toggle-button {
  display: none !important;
}


/* ===== SKUD UI manual cleanup 2026-06-05 ===== */
.skud-nav-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
  padding: 10px 12px;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  background: #f8fbff;
}

.skud-nav-primary,
.skud-nav-service {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.skud-nav-link,
.skud-service-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #d8e3f2;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2937 !important;
  text-decoration: none !important;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.skud-service-link {
  font-size: 13px;
  background: #eef3f9;
}

.skud-nav-link:hover,
.skud-service-link:hover {
  background: #eaf2ff;
  border-color: #bcd2f6;
}

.skud-nav-link.active,
.skud-service-link.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff !important;
}

.skud-page-actions {
  align-items: center;
  justify-content: flex-end;
}

.skud-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
}

.skud-row-actions form {
  display: inline-flex;
  margin: 0;
}

.table-action-button,
.status-action {
  min-height: 28px !important;
  padding: 5px 8px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  line-height: 1.1 !important;
}

.skud-note {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
}

.skud-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.skud-ok {
  background: #e7f7ec;
  color: #116329;
  border: 1px solid #a9dfb7;
}

.skud-bad {
  background: #fdeaea;
  color: #9b1c1c;
  border: 1px solid #f3b1b1;
}

.skud-warn {
  background: #fff6db;
  color: #7a4d00;
  border: 1px solid #f0d48a;
}

.skud-info {
  background: #eef4ff;
  color: #174ea6;
  border: 1px solid #b7cdfa;
}

.skud-muted {
  background: #f1f3f4;
  color: #555;
  border: 1px solid #ddd;
}

.skud-small {
  display: block;
  margin-top: 4px;
  color: #666;
  font-size: 12px;
  line-height: 1.25;
}

.skud-status-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.skud-status-box form {
  margin: 0;
}

.skud-inline-menu {
  position: relative;
  display: inline-block;
}

.skud-inline-menu > summary {
  list-style: none;
  cursor: pointer;
}

.skud-inline-menu > summary::-webkit-details-marker {
  display: none;
}

.skud-inline-menu-body {
  position: absolute;
  right: 0;
  z-index: 40;
  min-width: 220px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #d8e3f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

.skud-inline-menu-body form {
  display: grid;
  gap: 7px;
  margin: 0;
}

.skud-inline-menu-body label {
  font-size: 12px;
  font-weight: 800;
}

.skud-custom-days {
  display: none;
}

.skud-terminals-table td,
.skud-table td {
  vertical-align: top;
}

.button.danger,
button.danger {
  background: #b42318 !important;
  border-color: #b42318 !important;
  color: #ffffff !important;
}

.button.danger:hover,
button.danger:hover {
  background: #991b1b !important;
  border-color: #991b1b !important;
  color: #ffffff !important;
}

@media (max-width: 900px) {
  .skud-nav-panel {
    align-items: stretch;
  }

  .skud-nav-primary,
  .skud-nav-service {
    width: 100%;
  }

  .skud-nav-link,
  .skud-service-link {
    flex: 1 1 auto;
  }

  .skud-inline-menu-body {
    left: 0;
    right: auto;
  }
}


/* SIM service type extension */
.service-tabs {
  margin-top: 8px;
}
.service-badge {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}
html[data-theme="dark"] .service-badge {
  background: #0c4a6e;
  color: #e0f2fe;
  border-color: #0369a1;
}
