:root {
  color-scheme: dark;
  --bg: #071018;
  --sidebar: #08131c;
  --surface: #111c25;
  --surface-2: #15222c;
  --surface-3: #192832;
  --border: #334550;
  --border-soft: #263741;
  --text: #f4f7f9;
  --muted: #91a1ab;
  --teal: #2fbcc1;
  --teal-dark: #167b82;
  --blue: #438fe3;
  --purple: #8f57e3;
  --danger: #f06a6a;
  --shadow: 0 12px 30px rgb(0 0 0 / 0.2);
  --radius: 9px;
  font-family:
    Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 88% 0%, rgb(38 103 114 / 0.12), transparent 30%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  flex: 0 0 auto;
  vertical-align: middle;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: 224px;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #0a1720 0%, #07111a 100%);
  box-shadow: 8px 0 28px rgb(0 0 0 / 0.14);
}

.brand {
  display: flex;
  height: 72px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgb(47 188 193 / 0.55);
  border-radius: 7px;
  background: rgb(47 188 193 / 0.12);
  color: #70e0e1;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.primary-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 18px 10px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c9d2d7;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.nav-item:hover {
  background: rgb(255 255 255 / 0.045);
  color: #fff;
}

.nav-item--active {
  background: linear-gradient(90deg, rgb(31 143 150 / 0.34), rgb(31 143 150 / 0.11));
  color: #67e1df;
}

.nav-item--active::before {
  position: absolute;
  inset: 6px auto 6px -10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--teal);
  content: "";
}

.nav-item--settings {
  margin: 0 10px 14px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0;
  padding-top: 12px;
}

.page-shell {
  min-width: 0;
  margin-left: 224px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 11px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: rgb(7 16 24 / 0.92);
  backdrop-filter: blur(16px);
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 650;
  letter-spacing: -0.035em;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.today {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd4d9;
  white-space: nowrap;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dde6e9;
  line-height: 1.2;
  white-space: nowrap;
}

.save-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #63d681;
  box-shadow: 0 0 0 5px rgb(99 214 129 / 0.08);
}

.save-status small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface);
}

.desktop-menu {
  display: none;
}

.mobile-only {
  display: none;
}

.content {
  width: min(100%, 1700px);
  margin: 0 auto;
  padding: 18px 22px 32px;
}

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.button:hover {
  border-color: #50636e;
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.button--primary {
  border-color: #299ba1;
  background: linear-gradient(180deg, #279fa5, #197c83);
  box-shadow: 0 7px 18px rgb(18 130 137 / 0.2);
}

.button--primary:hover {
  border-color: #48c8cc;
  background: linear-gradient(180deg, #30b3b8, #1e8a90);
}

.button--ghost {
  background: rgb(255 255 255 / 0.015);
}

.button--small {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 12px;
}

.button--danger {
  border-color: #704848;
  color: #e2a0a0;
}

.button--danger:hover {
  border-color: #a85e5e;
  background: rgb(170 78 78 / 0.12);
}

.button--delete {
  border-color: #a64f4f;
  background: linear-gradient(180deg, #a84747, #813838);
  color: #fff;
}

.button--delete:hover {
  border-color: #d66c6c;
  background: linear-gradient(180deg, #bb5555, #934040);
}

.filter-panel,
.entry-panel,
.records-panel,
.chart-panel,
.kpi-card,
.summary-strip {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgb(22 35 45 / 0.98), rgb(15 26 35 / 0.98));
  box-shadow: var(--shadow);
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr)) minmax(190px, 1.5fr) auto;
  gap: 12px;
  align-items: end;
  padding: 13px;
  border-radius: var(--radius);
}

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

.filter-field > span:first-child,
.field > span:first-child {
  color: #d2dadd;
  font-size: 11px;
  font-weight: 600;
}

.field b {
  color: #ff7777;
}

input,
select,
output {
  width: 100%;
  min-height: 40px;
  border: 1px solid #40525d;
  border-radius: 6px;
  background: #0e1922;
  color: var(--text);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

input,
select {
  padding: 0 11px;
}

input::placeholder {
  color: #6f808a;
}

input:hover,
select:hover {
  border-color: #586b76;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgb(47 188 193 / 0.1);
  outline: none;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9badb6 50%),
    linear-gradient(135deg, #9badb6 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 29px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .icon {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 11px;
  color: var(--muted);
}

.input-with-icon input {
  padding-left: 36px;
}

.filter-field--search {
  grid-column: auto;
}

.filter-clear {
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.kpi-card {
  position: relative;
  min-height: 137px;
  overflow: hidden;
  padding: 17px 18px 15px;
  border-radius: var(--radius);
}

.kpi-card::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 80%);
  content: "";
}

.kpi-label {
  margin-bottom: 18px;
  color: #c5d0d5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.kpi-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kpi-content strong {
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 520;
  letter-spacing: -0.04em;
}

.kpi-content > span:last-child {
  align-self: flex-end;
  margin-bottom: 6px;
  color: #c9d3d8;
  font-size: 12px;
}

.kpi-icon {
  display: grid;
  width: 47px;
  height: 47px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: #f5ffff;
}

.kpi-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.chart-panel {
  min-height: 300px;
  padding: 16px 18px 20px;
  border-radius: var(--radius);
}

.chart-panel--division {
  grid-column: 1 / -1;
  min-height: 210px;
}

.chart-panel h2,
.records-panel h2,
.entry-panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.chart-panel h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.bar-chart {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: center;
  gap: 17px;
  padding-top: 17px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(80px, 1fr) 84px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  overflow: hidden;
  color: #dfe6e9;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 19px;
  border: 1px solid #2c3e49;
  background: #0a141c;
}

.bar-fill {
  height: 100%;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}

.bar-row strong {
  color: #d7e0e4;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
}

.division-chart {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  padding: 26px 8px 8px;
}

.division-stat {
  padding: 4px 10px;
}

.division-stat__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dbe4e7;
}

.division-stat__heading span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.division-stat__heading i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.division-stat__heading strong {
  color: #9eacb3;
  font-size: 13px;
}

.division-stat__value {
  margin: 16px 0 15px;
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 520;
  letter-spacing: -0.04em;
}

.division-stat__value small {
  color: var(--muted);
  font-size: 13px;
}

.division-track {
  height: 13px;
  overflow: hidden;
  border: 1px solid #30434e;
  border-radius: 2px;
  background: #09141b;
}

.division-track span {
  display: block;
  height: 100%;
}

.records-panel {
  overflow: hidden;
  margin-top: 10px;
  border-radius: var(--radius);
}

.panel-heading,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-heading p,
.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

th,
td {
  border-right: 1px solid #31434e;
  border-bottom: 1px solid #31434e;
  padding: 10px 11px;
  text-align: left;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

thead {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #13212b;
}

th {
  padding: 0;
  color: #dce4e7;
  font-size: 11px;
  font-weight: 650;
}

td {
  color: #d2dbdf;
  font-size: 12px;
}

tbody tr:nth-child(even) {
  background: rgb(255 255 255 / 0.018);
}

tbody tr:hover {
  background: rgb(47 188 193 / 0.065);
}

.sort-button {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.sort-button .icon {
  color: #738690;
}

.sort-button--active {
  color: #66d7d8;
}

.sort-button--active .icon {
  color: #66d7d8;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.job-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine-name {
  color: #e3ebee;
  font-weight: 600;
}

.table-action {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid #258f94;
  border-radius: 5px;
  background: rgb(30 149 155 / 0.07);
  color: #55d8d7;
  font-size: 12px;
}

.table-action:hover {
  background: rgb(30 149 155 / 0.18);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-action--delete {
  border-color: #724b4b;
  background: rgb(154 68 68 / 0.06);
  color: #dfa0a0;
}

.table-action--delete:hover {
  border-color: #a85e5e;
  background: rgb(170 78 78 / 0.15);
}

.empty-table {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

.table-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  min-height: 61px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 11px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.page-button {
  display: grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0e1922;
  color: #d8e0e3;
}

.page-button:hover:not(:disabled) {
  border-color: #647781;
}

.page-button--active {
  border-color: #30aeb3;
  background: #238f95;
  color: white;
}

.page-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.page-gap {
  color: var(--muted);
}

.rows-select {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rows-select select {
  width: 68px;
  min-height: 34px;
}

.entry-panel {
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: var(--radius);
}

.section-title h2 {
  color: #61dcda;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 15px 13px;
  padding: 15px 16px 16px;
}

.field--wide {
  grid-column: span 3;
}

.field--duration output {
  display: flex;
  align-items: center;
  padding: 0 11px;
  color: #9baab2;
  font-variant-numeric: tabular-nums;
}

.form-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--border-soft);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--radius);
}

.summary-strip > div {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  gap: 15px;
  border-right: 1px solid var(--border);
  color: #c6d0d5;
}

.summary-strip > div:last-child {
  border-right: 0;
}

.summary-strip .icon {
  color: #d5e0e4;
}

.summary-strip span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.summary-strip strong {
  color: #62d7d5;
  font-size: 21px;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
}

.section-title--tabs {
  align-items: flex-end;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0d1820;
}

.segmented button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.segmented button.active {
  background: #1b777d;
  color: white;
}

.manager-note {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
  padding: 12px 15px;
  border: 1px solid #526174;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgb(67 104 143 / 0.18), rgb(22 35 45 / 0.75));
  color: #dbe7ee;
}

.manager-note .icon {
  color: #76b9ee;
}

.manager-note div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.manager-note span {
  color: var(--muted);
  font-size: 12px;
}

.operator-form {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(420px, 1.5fr) minmax(230px, 0.7fr);
  gap: 18px;
  align-items: end;
  padding: 17px 16px;
}

.machine-assignment {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.machine-assignment legend {
  margin-bottom: 8px;
  color: #d2dadd;
  font-size: 11px;
  font-weight: 600;
}

.machine-assignment b {
  color: #ff7777;
}

.machine-checkboxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 7px;
}

.check-card {
  position: relative;
  min-width: 0;
}

.check-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-card span {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #40525d;
  border-radius: 6px;
  background: #0e1922;
  color: #aebdc4;
  font-size: 12px;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.check-card input:checked + span {
  border-color: #299ba1;
  background: rgb(36 142 149 / 0.18);
  color: #6ee0df;
}

.check-card input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.status-switch {
  position: relative;
  display: flex;
  min-height: 62px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #40525d;
  border-radius: 6px;
  background: #0e1922;
}

.status-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.status-switch > span {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  column-gap: 10px;
}

.status-switch i {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  grid-row: span 2;
  border-radius: 99px;
  background: #40515a;
  transition: background 120ms ease;
}

.status-switch i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dce5e8;
  content: "";
  transition: transform 120ms ease;
}

.status-switch input:checked + span i {
  background: #208e94;
}

.status-switch input:checked + span i::after {
  transform: translateX(16px);
}

.status-switch strong {
  color: #dce5e8;
  font-size: 12px;
}

.status-switch small {
  color: var(--muted);
  font-size: 10px;
}

.operator-form-actions {
  align-self: stretch;
  grid-column: 1 / -1;
}

.operator-directory {
  margin-top: 10px;
}

.operator-list {
  display: flex;
  flex-direction: column;
}

.operator-row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 0.75fr) minmax(320px, 1.6fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 72px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-soft);
}

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

.operator-row--inactive {
  opacity: 0.58;
}

.operator-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #2e8d93;
  border-radius: 7px;
  background: rgb(39 147 153 / 0.15);
  color: #69dbda;
  font-size: 12px;
  font-weight: 750;
}

.operator-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.operator-identity strong {
  color: #e4ebee;
  font-size: 13px;
}

.status-label {
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-label--active {
  border-color: #368d62;
  background: rgb(59 156 105 / 0.12);
  color: #7ae3a7;
}

.status-label--inactive {
  border-color: #7b5353;
  background: rgb(171 84 84 / 0.1);
  color: #d59a9a;
}

.operator-machines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.operator-machines span {
  padding: 4px 8px;
  border: 1px solid #40515b;
  border-radius: 5px;
  background: #0e1922;
  color: #aebdc4;
  font-size: 10px;
}

.operator-machines em {
  color: var(--muted);
  font-size: 11px;
}

.operator-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid #359da2;
  border-radius: 7px;
  background: #112830;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.4);
  color: #dffafa;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sidebar-backdrop {
  position: fixed;
  z-index: 25;
  inset: 0;
  border: 0;
  background: rgb(0 0 0 / 0.55);
}

.modal-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(1 7 11 / 0.76);
  backdrop-filter: blur(5px);
}

.confirm-dialog {
  display: grid;
  width: min(100%, 510px);
  grid-template-columns: 48px 1fr;
  gap: 13px 15px;
  padding: 21px;
  border: 1px solid #5b4548;
  border-radius: 10px;
  background: linear-gradient(180deg, #17232c, #101a22);
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.55);
}

.confirm-dialog__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #8e5050;
  border-radius: 8px;
  background: rgb(163 67 67 / 0.14);
  color: #ef9b9b;
}

.confirm-dialog h2 {
  margin: 1px 0 6px;
  font-size: 19px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.delete-summary {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 4px 0 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--border-soft);
}

.delete-summary div {
  padding: 10px 12px;
  background: #0e1922;
}

.delete-summary div:last-child {
  grid-column: 1 / -1;
}

.delete-summary dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.delete-summary dd {
  margin: 4px 0 0;
  color: #e1e8eb;
  font-size: 12px;
}

.confirm-dialog__actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 5px;
}

.auth-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 75% 15%, rgb(40 151 158 / 0.18), transparent 28%),
    radial-gradient(circle at 15% 85%, rgb(54 97 151 / 0.12), transparent 30%),
    #071018;
}

.auth-card {
  width: min(100%, 470px);
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid #38505d;
  border-radius: 14px;
  background: linear-gradient(180deg, rgb(20 34 44 / 0.98), rgb(12 23 31 / 0.98));
  box-shadow: 0 32px 90px rgb(0 0 0 / 0.45);
}

.auth-card--loading {
  text-align: center;
}

.auth-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
}

.auth-logo {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(69 206 209 / 0.6);
  border-radius: 12px;
  background: rgb(47 188 193 / 0.14);
  color: #75e3e1;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.auth-card--loading .auth-logo {
  margin: 0 auto 24px;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(23px, 5vw, 31px);
  letter-spacing: -0.04em;
}

.auth-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-submit {
  min-height: 47px;
  margin-top: 5px;
}

.auth-error {
  margin-bottom: 17px;
  padding: 11px 13px;
  border: 1px solid #895050;
  border-radius: 7px;
  background: rgb(165 70 70 / 0.12);
  color: #f0b0b0;
  font-size: 12px;
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px !important;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
}

.auth-note .icon {
  margin-top: 1px;
  color: #6ed6d6;
}

.loading-ring {
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border: 3px solid #29404c;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

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

.sidebar-account {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  margin: 0 10px 13px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border-soft);
}

.sidebar-account > span:nth-child(2) {
  min-width: 0;
}

.sidebar-account strong,
.sidebar-account small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account strong {
  color: #e4ebee;
  font-size: 11px;
}

.sidebar-account small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.sidebar-account .icon-button {
  width: 34px;
  height: 34px;
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #3f777b;
  border-radius: 50%;
  background: rgb(39 147 153 / 0.14);
  color: #78dddc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.user-avatar--large {
  width: 42px;
  height: 42px;
  font-size: 12px;
}

.audit-filters {
  grid-template-columns: minmax(140px, 0.5fr) minmax(170px, 0.7fr) minmax(280px, 1.8fr);
  margin-bottom: 10px;
}

.audit-table {
  min-width: 930px;
}

.cell-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.audit-action,
.role-label {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid #46606c;
  border-radius: 99px;
  background: #12232d;
  color: #bed0d7;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.audit-action--create,
.audit-action--activate,
.role-label--operator {
  border-color: #397f60;
  color: #78dca4;
}

.audit-action--update,
.audit-action--migrate,
.role-label--manager {
  border-color: #3b7195;
  color: #78bde9;
}

.audit-action--delete,
.audit-action--deactivate {
  border-color: #805050;
  color: #e39d9d;
}

.audit-action--setup,
.role-label--admin {
  border-color: #7655a0;
  color: #c49bea;
}

.audit-detail-row,
.audit-detail-row:hover {
  background: #0b161e !important;
}

.audit-detail-row td {
  padding: 0;
  white-space: normal;
}

.audit-change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 13px;
}

.audit-change {
  display: grid;
  grid-template-columns: minmax(90px, 0.5fr) 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #101c24;
}

.audit-change > strong {
  align-self: center;
  color: #dce6e9;
  font-size: 11px;
}

.audit-change span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #bcc9ce;
  font-size: 11px;
}

.audit-change small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.audit-no-change {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 15px;
  align-items: end;
  padding: 16px;
}

.role-help {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.role-help span {
  padding: 10px 11px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #0e1922;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.role-help strong {
  display: block;
  margin-bottom: 2px;
  color: #dce6e9;
  font-size: 11px;
}

.user-form-actions {
  grid-column: 1 / -1;
}

.user-directory {
  margin-top: 10px;
}

.user-list {
  display: flex;
  flex-direction: column;
}

.user-row {
  display: grid;
  grid-template-columns: 48px minmax(190px, 1fr) 125px 80px auto;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-soft);
}

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

.user-row--inactive {
  opacity: 0.58;
}

.user-identity strong,
.user-identity span {
  display: block;
}

.user-identity strong {
  color: #e5ecef;
  font-size: 13px;
}

.user-identity span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1380px) {
  .filter-panel {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .filter-field--search {
    grid-column: span 2;
  }

  .entry-form {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .field--wide {
    grid-column: span 2;
  }

  .operator-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .machine-assignment {
    grid-column: span 2;
  }

  .operator-row {
    grid-template-columns: 44px minmax(150px, 0.8fr) minmax(240px, 1.4fr) auto;
  }

  .user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-row {
    grid-template-columns: 48px minmax(170px, 1fr) 120px 76px auto;
  }

  .audit-change-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    width: 205px;
  }

  .page-shell {
    margin-left: 205px;
  }

  .brand {
    padding-inline: 13px;
    font-size: 14px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .today {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: min(84vw, 290px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar--open {
    z-index: 35;
    transform: translateX(0);
  }

  .page-shell {
    margin-left: 0;
  }

  .desktop-menu,
  .mobile-only {
    display: grid;
  }

  .brand .mobile-only {
    margin-left: -6px;
  }

  .topbar {
    padding-inline: 13px;
  }

  .topbar-actions .save-status {
    display: none;
  }

  .table-scroll {
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .content {
    padding: 13px 12px 25px;
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-field--search {
    grid-column: 1 / -1;
  }

  .filter-clear {
    width: 100%;
  }

  .entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .division-chart {
    grid-template-columns: 1fr;
  }

  .operator-form {
    grid-template-columns: 1fr;
  }

  .machine-assignment {
    grid-column: auto;
  }

  .machine-checkboxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operator-row {
    grid-template-columns: 44px 1fr;
  }

  .operator-machines,
  .operator-actions {
    grid-column: 2;
  }

  .operator-actions {
    justify-content: flex-start;
  }

  .audit-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-filters .filter-field--search {
    grid-column: 1 / -1;
  }

  .audit-table {
    display: block;
    min-width: 0;
  }

  .audit-table thead {
    display: none;
  }

  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
    width: 100%;
  }

  .audit-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .audit-table tr:not(.audit-detail-row) {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #101c24;
  }

  .audit-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 9px;
    padding: 9px 11px;
    border-right: 0;
    white-space: normal;
  }

  .audit-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .audit-table .audit-detail-row {
    grid-column: 1 / -1;
    margin-top: -10px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

  .audit-table .audit-detail-row td {
    display: block;
    padding: 0;
  }

  .audit-table .audit-detail-row td::before {
    display: none;
  }

  .user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-help {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 48px 1fr auto;
  }

  .user-row .role-label {
    justify-self: start;
  }

  .user-row .status-label {
    grid-column: 2;
    justify-self: start;
  }

  .user-row .operator-actions {
    grid-column: 2 / -1;
  }

  .field--wide {
    grid-column: 1 / -1;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-strip > div:nth-child(2) {
    border-right: 0;
  }

  .summary-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .table-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .rows-select {
    justify-content: center;
  }

  .section-title--tabs {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar p {
    display: none;
  }

  .topbar-actions .button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .topbar-actions .button .icon {
    width: 19px;
    height: 19px;
  }

  input,
  select {
    min-height: 44px;
    font-size: 16px;
  }

  .button {
    min-height: 44px;
  }

  .filter-panel,
  .entry-form,
  .audit-filters,
  .user-form {
    grid-template-columns: 1fr;
  }

  .filter-field--search,
  .field--wide {
    grid-column: auto;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 120px;
  }

  .bar-row {
    grid-template-columns: 74px minmax(65px, 1fr) 73px;
    gap: 7px;
  }

  .bar-row strong {
    font-size: 10px;
  }

  .panel-heading,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading .button {
    width: 100%;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip > div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .summary-strip > div:last-child {
    border-bottom: 0;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .button {
    width: 100%;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }

  .machine-checkboxes {
    grid-template-columns: 1fr;
  }

  .operator-row {
    align-items: start;
  }

  .operator-identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .operator-actions {
    flex-direction: column;
  }

  .operator-actions .button {
    width: 100%;
  }

  .user-row {
    grid-template-columns: 44px 1fr;
  }

  .user-row .role-label,
  .user-row .status-label,
  .user-row .operator-actions {
    grid-column: 2;
  }

  .audit-table {
    display: block;
    min-width: 0;
  }

  .audit-table thead {
    display: none;
  }

  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
    width: 100%;
  }

  .audit-table tbody {
    display: block;
    padding: 8px;
  }

  .audit-table tr:not(.audit-detail-row) {
    margin-bottom: 9px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #101c24;
  }

  .audit-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 9px;
    padding: 9px 11px;
    border-right: 0;
    white-space: normal;
  }

  .audit-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .audit-table .audit-detail-row {
    margin: -9px 0 10px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

  .audit-table .audit-detail-row td {
    display: block;
    padding: 0;
  }

  .audit-table .audit-detail-row td::before {
    display: none;
  }

  .audit-change {
    grid-template-columns: 1fr;
  }

  .table-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .confirm-dialog {
    grid-template-columns: 1fr;
  }

  .delete-summary,
  .confirm-dialog__actions {
    grid-column: 1;
  }

  .confirm-dialog__actions {
    flex-direction: column-reverse;
  }

  .confirm-dialog__actions .button {
    width: 100%;
  }

  .auth-shell {
    align-items: start;
    padding: 14px;
  }

  .auth-card {
    margin-top: 5vh;
    padding: 22px 18px;
  }

  .auth-heading {
    align-items: flex-start;
  }

  .auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 14px;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
