﻿body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  margin: 0;
  background: #f4f6f8;
  color: #223;
  font-size: 16px;
  overflow-y: scroll;
}

.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #d8ecff 0%, #f4f6f8 55%);
}

.login-card {
  width: min(420px, 96vw);
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(19, 45, 74, 0.14);
  padding: 22px;
  display: grid;
  gap: 10px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  color: #1f3350;
}

.login-card label {
  font-size: 15px;
  font-weight: 600;
  color: #314867;
}

.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #c3cfdb;
  border-radius: 10px;
  font-size: 16px;
}

.login-card button {
  margin-top: 4px;
}

.login-error {
  min-height: 20px;
  color: #b42318;
  font-size: 14px;
}

body.authenticated .login-screen {
  display: none;
}

body:not(.authenticated) .app {
  display: none;
}

.app {
  display: block;
  min-height: 100dvh;
}

.sidebar {
  width: 290px;
  min-width: 290px;
  max-width: 290px;
  flex: 0 0 290px;
  background: #15324b;
  color: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar h1 {
  margin: 4px 0 8px;
  font-size: 52px;
  line-height: 0.98;
}

.sidebar-tabs {
  display: grid;
  gap: 8px;
}

.sidebar button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #c2c9d9;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #1d2939;
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(61, 114, 181, 0.08),
    0 3px 0 rgba(151, 165, 190, 0.35),
    0 10px 22px rgba(31, 51, 78, 0.08);
}

.sidebar button:hover {
  background: #f0f6ff;
  border-color: #8ea5d7;
}

.sidebar button.active {
  background: linear-gradient(135deg, #3d72b5, #244f8d);
  border-color: #3d72b5;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -10px 18px rgba(10, 36, 75, 0.16),
    0 4px 0 rgba(24, 68, 130, 0.42),
    0 14px 24px rgba(36, 79, 141, 0.24);
}

.report-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.report-box label,
.rolebox label {
  font-size: 17px;
}

.report-box select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #c3cfdb;
  font-size: 15px;
}

.content {
  margin-left: 290px;
  width: calc(100% - 290px);
  padding: 18px;
  min-width: 0;
  box-sizing: border-box;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.hidden {
  display: none !important;
}

.split {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 16px;
}

.right-panel,
.card {
  background: #fff;
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#bulkResult {
  margin-top: 10px;
  color: #2b3b52;
  font-size: 15px;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  padding: 8px 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
  font-size: 15px;
}

.toolbar button {
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
}

.grid-range {
  margin: 0 0 8px;
  font-size: 13px;
  color: #4d5a69;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

textarea {
  width: 100%;
  box-sizing: border-box;
}

button {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid #2f63a5;
  background: linear-gradient(135deg, #4d82c5 0%, #2f63a5 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -10px 16px rgba(16, 50, 96, 0.2),
    0 4px 0 rgba(24, 68, 130, 0.42),
    0 13px 22px rgba(47, 99, 165, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

button::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 45%;
  border-radius: 13px 13px 8px 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0));
  pointer-events: none;
}

button:hover {
  border-color: #244f8d;
  filter: brightness(1.04);
  transform: translateY(-3px) scale(1.012);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 16px rgba(16, 50, 96, 0.18),
    0 6px 0 rgba(24, 68, 130, 0.36),
    0 18px 28px rgba(47, 99, 165, 0.24);
}

button:active {
  transform: translateY(2px) scale(0.992);
  filter: brightness(0.97);
  box-shadow:
    inset 0 4px 10px rgba(16, 50, 96, 0.3),
    0 0 0 rgba(24, 68, 130, 0),
    0 3px 8px rgba(47, 99, 165, 0.14);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.62;
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 0 rgba(151, 165, 190, 0.35),
    0 7px 14px rgba(31, 51, 78, 0.08);
}

.item {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planning-year-item {
  display: grid;
  grid-template-columns: 160px auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.planning-year-item span {
  font-size: 16px;
  color: #3a4c64;
}

.plan-row-item {
  display: grid;
  grid-template-columns: 180px 150px 140px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.plan-row-open {
  width: 100%;
}

.plan-row-count {
  font-size: 17px;
  font-weight: 700;
  color: #1f3552;
}

.plan-row-delete {
  display: flex;
  justify-content: flex-start;
}

.plan-current-head {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 6px 0;
  font-size: 17px;
}

.selected-plan {
  background: #eef3ff;
}

.op {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fff;
  font-size: 14px;
}

.op .meta {
  display: flex;
  gap: 10px;
  font-weight: 700;
}

.op-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.op-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.fact-edit-grid {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.fact-edit-row {
  display: flex;
  gap: 6px;
}

.fact-edit-row input {
  flex: 1;
}

.ops-toolbar {
  margin-bottom: 10px;
}

.op.gray {
  border-left: 8px solid #9aa3ad;
}

.op.green {
  border-left: 8px solid #38b26d;
}

.op.orange {
  border-left: 8px solid #f29b38;
}

.rolebox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ghost-btn {
  border: 1px solid #9eb2cc;
  background: linear-gradient(180deg, #f5f8fc, #e2eaf5);
  color: #1f3552;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.82),
    0 3px 0 rgba(145, 161, 185, 0.34),
    0 10px 20px rgba(30, 48, 77, 0.12);
}

.ghost-btn:hover {
  border-color: #7f96b4;
}

.rolebox input,
.rolebox select,
.modal-form input,
.modal-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #c3cfdb;
  font-size: 15px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 35, 57, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 92vw);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
  padding: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-head h3 {
  margin: 0;
}

.modal-subtitle {
  font-size: 13px;
  color: #4f5b6c;
  margin-bottom: 12px;
}

.modal-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.icon-btn {
  border: 1px solid #cdd7e4;
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
}

.field-invalid {
  border-color: #c53b3b !important;
  background: #fff2f2;
}

#currentUser {
  font-size: 15px;
  opacity: 0.95;
}

.muted {
  color: #627087;
  font-size: 12px;
}

.grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 12px;
  color: #4d5a69;
}

.grid-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-chip {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #d0d7e2;
}

.legend-chip.plan-range,
.legend-chip.fact-completed {
  background: #7bd88f;
}

.legend-chip.fact-progress {
  background: #78aefc;
}

.legend-chip.fact-plan {
  background: #c0c6cf;
}

.legend-chip.fact-overdue {
  background: #ffbd6f;
}

.legend-chip.weekend {
  background: #ffd6e5;
}

.legend-chip.holiday {
  background: #ffc5dc;
}

.schedule-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: auto;
  border: 1px solid #dde3ec;
  cursor: grab;
  user-select: none;
}

.schedule-wrap.dragging {
  cursor: grabbing;
}

.schedule-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  min-width: max-content;
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid #dfe4ec;
  border-bottom: 1px solid #dfe4ec;
  padding: 4px;
  height: 24px;
  box-sizing: border-box;
  white-space: nowrap;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  font-weight: 700;
  font-size: 16px;
}

.month-head {
  background: #eef3ff;
  text-align: center;
  color: #273246;
}

.day-head {
  width: 26px;
  min-width: 26px;
  text-align: center;
  background: #f7f9fc;
  font-size: 14px;
}

.day-head.nonwork {
  background: #ffd6e5;
}

.day-head.holiday {
  background: #ffc5dc;
}

.left-col {
  position: sticky;
  z-index: 4;
  background: #fff;
  white-space: normal;
  line-height: 1.18;
}

.schedule-table thead .left-col {
  background: #f7f9fc;
  z-index: 5;
}

.left-col-idx {
  left: 0;
  min-width: 58px;
  max-width: 58px;
  text-align: center;
}

.left-col-wagon {
  left: 58px;
  min-width: 96px;
  max-width: 96px;
}

.left-col-repair {
  left: 154px;
  min-width: 132px;
  max-width: 132px;
}

.left-col-depot {
  left: 286px;
  min-width: 84px;
  max-width: 84px;
}

.left-col-track {
  left: 370px;
  min-width: 84px;
  max-width: 84px;
}

.left-col-position {
  left: 454px;
  min-width: 120px;
  max-width: 120px;
}

.left-col-area {
  left: 574px;
  min-width: 84px;
  max-width: 84px;
}

.left-col-status {
  left: 658px;
  min-width: 98px;
  max-width: 98px;
}

.left-col-area-plan {
  left: 370px;
  min-width: 84px;
  max-width: 84px;
}

.left-col-status-plan {
  left: 454px;
  min-width: 98px;
  max-width: 98px;
}

.left-col-action-plan {
  left: 552px;
  min-width: 220px;
  max-width: 220px;
  text-align: center;
}

.left-col-action-plan button {
  min-width: 92px;
  padding: 8px 8px;
  font-size: 14px;
}

.left-col-action-plan button + button {
  margin-left: 6px;
}

.left-col-progress {
  left: 756px;
  min-width: 122px;
  max-width: 122px;
  text-align: center;
}

.schedule-table thead .left-col-progress {
  white-space: normal;
  line-height: 1.12;
  font-size: 14px;
}

.wagon-row.selected td {
  background-color: #e8f2ff;
}

.danger-btn {
  border-color: #b42318;
  background: linear-gradient(135deg, #e35d4f 0%, #b42318 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.32),
    inset 0 -10px 16px rgba(91, 26, 18, 0.18),
    0 4px 0 rgba(124, 45, 18, 0.42),
    0 13px 22px rgba(180, 35, 24, 0.16);
}

.danger-btn:hover {
  border-color: #991b1b;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.38),
    inset 0 -10px 16px rgba(91, 26, 18, 0.16),
    0 6px 0 rgba(124, 45, 18, 0.36),
    0 18px 28px rgba(180, 35, 24, 0.22);
}

.day-cell {
  width: 26px;
  min-width: 26px;
  text-align: center;
  font-size: 13px;
  color: #1f5d35;
  background: #fff;
}

.day-cell.nonwork {
  background: #ffd6e5;
}

.day-cell.holiday {
  background: #ffc5dc;
}

.day-cell.block-green {
  background: #7bd88f;
}

.day-cell.block-gray {
  background: #c0c6cf;
  color: #495664;
}

.day-cell.block-blue {
  background: #78aefc;
  color: #0f3d7a;
}

.day-cell.block-orange {
  background: #ffbd6f;
  color: #7a4712;
}

.wagon-row {
  cursor: pointer;
}

.wagon-row:hover td {
  background-color: #f1f5fa;
}

.wagon-row:hover .day-cell.block-green {
  background: #74cc87;
}

.wagon-row:hover .day-cell.block-gray {
  background: #b4bbc4;
}

.wagon-row:hover .day-cell.block-blue {
  background: #6ea2eb;
}

.fact-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.fact-subtabs button {
  min-height: 40px;
  padding: 8px 14px;
}

.fact-subtabs button.active {
  background: linear-gradient(135deg, #3d72b5, #244f8d);
  border-color: #3d72b5;
}

.dispatch-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}

.dispatch-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: #fff;
}

.dispatch-table th,
.dispatch-table td {
  border: 1px solid #cfd9e8;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}

.dispatch-table th {
  background: #edf3fb;
  color: #1f3552;
  font-size: 14px;
  font-weight: 700;
}

.dispatch-track-name {
  min-width: 180px;
  text-align: left !important;
  font-size: 16px;
  font-weight: 700;
}

.dispatch-table-cell {
  width: 118px;
  min-width: 118px;
  height: 74px;
  background: #f5f8fc;
}

.dispatch-table-empty {
  background: #f1f6fd;
}

.dispatch-table-missing {
  background: #e7edf6;
}

.dispatch-table-blocked {
  background: #000;
}

.dispatch-table-occupied {
  padding: 0;
}

.dispatch-track-card {
  background: #fff;
  border: 1px solid #d9e3ef;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.dispatch-track-head {
  font-weight: 700;
  margin-bottom: 8px;
  color: #1f3552;
}

.dispatch-wagon-number {
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.dispatch-wagon-chip {
  width: 100%;
  min-height: 72px;
  height: 100%;
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: center;
  padding: 5px 4px;
  cursor: grab;
}

.dispatch-wagon-chip:active {
  cursor: grabbing;
}

.dispatch-complete-btn {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 8px;
}

.dispatch-blocked-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
}

.dispatch-unassigned-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dispatch-unassigned-item {
  background: #e8eef6;
  border: 1px solid #d4deea;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dispatch-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.dispatch-field {
  min-width: 220px;
  flex: 1 1 220px;
}

.dispatch-form label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.dispatch-form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.dispatch-form button {
  min-width: 210px;
  min-height: 42px;
  margin-left: auto;
}

.tracks-form {
  display: grid;
  grid-template-columns: 140px 100px 1fr 1.2fr 1.1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.tracks-form input,
.tracks-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.track-row {
  display: grid;
  grid-template-columns: 140px 90px 1fr 1.2fr 1.1fr auto auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.track-row input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.color-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.color-row input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.wagon-row:hover .day-cell.block-orange {
  background: #f5b365;
}

.rules-card {
  margin-top: 16px;
}

.rules-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.rules-toolbar select {
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
  font-size: 14px;
}

.rules-form {
  display: grid;
  grid-template-columns: 2fr 90px 90px 90px 180px 160px auto auto auto;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.rules-form input,
.rules-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
  font-size: 14px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rules-table th,
.rules-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 6px;
  text-align: left;
}

.users-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 16px;
  margin-bottom: 16px;
}

.roles-card {
  max-width: 320px;
}

.role-pill {
  border: 1px solid #d7e0ec;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff, #eef4fb);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.role-pill-title {
  font-size: 16px;
  font-weight: 700;
  color: #1d3552;
}

.role-pill-code {
  margin-top: 3px;
  font-size: 12px;
  color: #5a6d84;
  text-transform: uppercase;
}

.users-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.users-form input,
.users-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

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

.user-selector-row {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.user-selector-row label {
  font-size: 15px;
  font-weight: 600;
}

.user-selector-row select {
  width: 100%;
  padding: 10px;
  border: 1px solid #c3cfdb;
  border-radius: 10px;
  font-size: 15px;
}

.user-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.user-editor-col {
  display: grid;
  gap: 6px;
}

.user-editor-col label {
  font-size: 14px;
  color: #334d6d;
  font-weight: 600;
}

.user-editor-col input,
.user-editor-col select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #c3cfdb;
  border-radius: 10px;
  font-size: 15px;
}

.user-editor-col-status {
  align-content: end;
}

.user-permissions-wrap {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #dfe6f1;
}

.user-permissions-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.user-actions-row {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.user-2fa-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-security-card {
  margin-bottom: 16px;
}

.user-security-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.user-security-card p {
  margin: 0 0 12px;
  font-size: 17px;
}

.user-security-form {
  max-width: 640px;
  display: grid;
  gap: 8px;
}

.user-security-form label {
  font-size: 17px;
  font-weight: 600;
}

.user-security-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #c3cfdb;
  border-radius: 10px;
  font-size: 16px;
}

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

.users-table th,
.users-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 6px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.users-table input,
.users-table select {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.perm-grid {
  display: grid;
  gap: 4px;
  min-width: 320px;
}

.perm-item {
  font-size: 13px;
  align-items: flex-start;
}

.user-pass-grid {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

.user-2fa {
  display: grid;
  gap: 6px;
  min-width: 120px;
}

.reports-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.report-actions {
  display: flex;
  align-items: end;
  justify-content: flex-start;
  gap: 8px;
}

.report-box label {
  font-size: 21px;
  font-weight: 700;
}

.report-box select,
.report-box input {
  font-size: 19px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c3cfdb;
}

.report-actions button {
  font-size: 18px;
  min-height: 48px;
}

.report-preview {
  margin-top: 10px;
  border-top: 1px solid #d9e3ef;
  padding-top: 10px;
}

.report-preview h3 {
  margin: 6px 0 10px;
  font-size: 26px;
}

.preview-meta {
  font-size: 15px;
  margin-bottom: 8px;
  color: #334c6d;
}

.preview-table-wrap {
  overflow: auto;
  border: 1px solid #dce4ef;
  border-radius: 10px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.preview-table th,
.preview-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}

.preview-table thead th {
  background: #f4f7fc;
  font-size: 17px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.twofa-card {
  width: min(520px, 94vw);
}

.twofa-wrap {
  display: grid;
  gap: 8px;
}

#twoFaQrImage {
  width: 200px;
  height: 200px;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #fff;
  justify-self: center;
}

.twofa-secret input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
  font-size: 14px;
}

#twoFaCode {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
  font-size: 16px;
}

.twofa-uri {
  font-size: 12px;
  color: #4c5e77;
  word-break: break-all;
}

.catalog-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #edf1f6;
}

.catalog-row input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #c3cfdb;
  border-radius: 8px;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8eef6;
}

.status-pill.active {
  background: #def7e7;
  color: #14683a;
}

.status-pill.blocked {
  background: #fde8e8;
  color: #8f2121;
}

.sec-outcome-success td {
  background: #e7f8ed;
}

.sec-outcome-warning td {
  background: #fff6dd;
}

.sec-outcome-error td,
.sec-outcome-blocked td {
  background: #fde8e8;
}

.sec-outcome-info td {
  background: #edf1f6;
}

@media (max-width: 1200px) {
  .sidebar {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    flex-basis: 250px;
  }

  .content {
    margin-left: 250px;
    width: calc(100% - 250px);
  }

  .sidebar button {
    font-size: 16px;
  }

  .sidebar h1 {
    font-size: 38px;
  }
}

@media (max-width: 1100px) {
  .split,
  .users-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .users-form,
  .rules-form,
  .reports-form,
  .tracks-form,
  .track-row,
  .color-row {
    grid-template-columns: 1fr;
  }

  .dispatch-field {
    min-width: 0;
    flex: 1 1 100%;
  }

  .dispatch-form button {
    margin-left: 0;
    width: 100%;
  }

  .user-editor-grid,
  .user-selector-row {
    grid-template-columns: 1fr;
  }

  .planning-year-item,
  .plan-row-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    margin-left: 0;
    width: 100%;
  }
}
