:root {
  --navy: #17385f;
  --navy-2: #0f2747;
  --blue: #2f66e8;
  --line: #c7d7ea;
  --soft: #f3f7fd;
  --soft-blue: #ddecff;
  --text: #0e1b2d;
  --muted: #64748b;
  --green: #d9ffe8;
  --green-border: #68e097;
  --red: #ffe0e0;
  --red-border: #ff8a8a;
  --yellow: #fff2c5;
  --yellow-border: #e6aa17;
  --shadow: 0 22px 60px rgba(15, 39, 71, .15);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(47,102,232,.13), transparent 34rem),
    linear-gradient(180deg, #f6f9ff 0%, #eef4fb 100%);
}

button, input, select {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  padding: 24px 20px;
  background: linear-gradient(180deg, #17385f 0%, #102b4d 100%);
  color: white;
  z-index: 10;
}

.brand-title {
  font-weight: 900;
  font-size: 1.45rem;
  line-height: 1.15;
}

.brand-subtitle {
  margin-top: 10px;
  color: rgba(255,255,255,.72);
  font-weight: 700;
}

.nav {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.nav-btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  background: transparent;
  color: rgba(255,255,255,.82);
  font-weight: 800;
  cursor: pointer;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255,255,255,.12);
  color: white;
}

.sidebar-footer {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.78);
  font-size: .88rem;
  line-height: 1.6;
}

.app-shell {
  margin-left: 232px;
  min-height: 100vh;
  padding: 28px 30px 70px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--navy-2);
}

.utc-pill, .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #eaf3ff;
  color: var(--navy);
  font-weight: 900;
  padding: 6px 14px;
}

.status-banner {
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--yellow-border);
  background: var(--yellow);
  color: #9a4b00;
  font-weight: 800;
}

.status-banner.error,
.modal-error {
  background: var(--red);
  border-color: var(--red-border);
  color: #9b1717;
}

.status-banner.success {
  background: var(--green);
  border-color: var(--green-border);
  color: #126236;
}

.hidden { display: none !important; }

.hero-card {
  max-width: 1400px;
  margin: 0 auto 22px;
  min-height: 215px;
  border-radius: 28px;
  padding: 48px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  color: white;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(100deg, rgba(13,32,64,.96), rgba(33,75,180,.90)),
    radial-gradient(circle at 70% 55%, rgba(255,255,255,.18), transparent 18rem);
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 65% 50%, rgba(255,255,255,.10) 0 5rem, transparent 5.2rem),
    radial-gradient(circle at 75% 50%, rgba(255,255,255,.08) 0 5rem, transparent 5.2rem);
  opacity: .9;
}

.hero-card > * { position: relative; z-index: 1; }

.hero-card h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.06;
}

.hero-card p {
  margin: 16px 0 0;
  color: rgba(255,255,255,.80);
  font-weight: 700;
  font-size: 1.15rem;
}

.hero-meta {
  text-align: right;
  font-weight: 800;
  color: rgba(255,255,255,.86);
  line-height: 1.55;
}

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

.panel {
  max-width: 1400px;
  margin: 0 auto;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 16px 45px rgba(15, 39, 71, .08);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0;
  color: var(--navy-2);
}

.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
  background: white;
  color: var(--navy);
  transition: transform .12s, background .12s, border-color .12s;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary {
  color: white;
  border-color: var(--navy);
  background: var(--navy);
}

.btn.secondary {
  color: var(--navy);
  background: white;
}

.btn.light {
  color: var(--navy);
  background: white;
}

.btn.danger {
  color: white;
  background: #dc2626;
  border-color: #dc2626;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  background: white;
}

.metric-card.green {
  background: var(--green);
  border-color: var(--green-border);
}

.metric-card.red {
  background: var(--red);
  border-color: var(--red-border);
}

.metric-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--navy);
}

.metric-value {
  margin-top: 14px;
  font-size: 2.2rem;
  font-weight: 950;
  color: var(--navy-2);
}

.filter-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid #a8ccff;
  background: #ddecff;
  margin-bottom: 20px;
}

.filter-card.small {
  margin: 16px 0;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.filter-head h3 {
  margin: 0 0 12px;
  color: var(--navy);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.5fr 1.1fr 1.1fr 1.1fr 1.1fr auto auto;
  gap: 12px;
  align-items: end;
}

.filter-grid.compact {
  grid-template-columns: 1fr 180px auto;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 16px;
  background: white;
  color: var(--text);
  font-weight: 750;
  outline: none;
  min-height: 48px;
}

input:focus, select:focus {
  border-color: #7eb3ff;
  box-shadow: 0 0 0 4px rgba(126,179,255,.22);
}

.table-wrap,
.admin-table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid #dce7f5;
}

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

th {
  background: #eaf4fb;
  color: var(--navy);
  text-align: left;
  padding: 16px;
  font-size: .88rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  border-top: 1px solid #e5eef8;
  padding: 14px 16px;
  vertical-align: top;
}

tbody tr:hover {
  background: #eef7ff;
}

.date-cell {
  font-weight: 850;
}

.record-ref {
  display: block;
  color: var(--muted);
  font-size: .88rem;
  margin-top: 4px;
}

.period-time {
  font-weight: 850;
  color: var(--navy);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 950;
  font-size: .88rem;
}

.badge.normal,
.badge.nml {
  background: var(--green);
  color: #15703a;
}

.badge.defect,
.badge.out {
  background: var(--red);
  color: #a51d1d;
}

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

.icon-btn {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--navy);
  cursor: pointer;
}

.icon-btn:hover {
  background: #eaf3ff;
  border-color: #9ec5ff;
}

.icon-btn.danger {
  color: #dc2626;
  border-color: #ffb1b1;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.empty-state, .notice {
  border: 1px solid #d9e5f2;
  background: #f8fbff;
  color: var(--muted);
  border-radius: 14px;
  padding: 18px;
  font-weight: 800;
}

.settings-panel {
  display: grid;
  gap: 16px;
  max-width: 820px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-modal { width: min(640px, 100%); }
.wide-modal { width: min(1180px, 100%); }
.extra-wide-modal { width: min(1320px, 100%); }
.small-modal { width: min(650px, 100%); }

.modal h2 {
  margin: 0 0 6px;
  font-size: 2rem;
  color: var(--navy-2);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.form-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin: 22px 0;
  display: grid;
  gap: 16px;
  background: #fbfdff;
}

.info-note {
  padding: 14px 16px;
  border: 1px solid #a8ccff;
  border-radius: 14px;
  background: #eaf3ff;
  color: #163f86;
  font-weight: 900;
}

.modal-error {
  border: 1px solid;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 900;
}

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

.modal-actions.stacked {
  display: grid;
  gap: 12px;
  justify-content: stretch;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

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

.mini-summary {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: white;
  color: var(--navy);
  font-weight: 850;
}

.equipment-list {
  display: grid;
  gap: 14px;
  padding-bottom: 74px;
}

.equipment-group {
  border: 1px solid #dce7f5;
  border-radius: 18px;
  overflow: hidden;
  background: white;
}

.equipment-group-head {
  padding: 13px 16px;
  background: #eaf4fb;
  color: var(--navy);
  font-weight: 950;
  display: flex;
  justify-content: space-between;
}

.equipment-row {
  display: grid;
  grid-template-columns: 70px 1fr 150px minmax(220px, .9fr);
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  border-top: 1px solid #edf3fa;
}

.equipment-name {
  font-weight: 850;
}

.equipment-meta {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
  margin-top: 3px;
}

.status-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.status-toggle button {
  border: 0;
  background: white;
  min-height: 42px;
  font-weight: 950;
  color: var(--muted);
  cursor: pointer;
}

.status-toggle button.active.nml {
  background: var(--green);
  color: #15703a;
}

.status-toggle button.active.out {
  background: var(--red);
  color: #a51d1d;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), white 32%);
  display: flex;
  justify-content: flex-end;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.report-chip {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}

.report-chip .label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.report-chip .value {
  margin-top: 4px;
  color: var(--navy-2);
  font-size: 1.05rem;
  font-weight: 950;
}

.admin-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  margin-top: 14px;
  overflow: hidden;
}

.admin-section summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 950;
  color: var(--navy);
  background: #f5f9ff;
}

.admin-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.compact-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
}

.compact-form.equipment-form {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.helper-text {
  color: var(--muted);
  font-weight: 750;
  padding: 0 14px 14px;
}

.admin-table-wrap {
  margin: 0 14px 14px;
  max-height: 420px;
}

.admin-table-wrap input,
.admin-table-wrap select {
  min-width: 120px;
  padding: 10px 12px;
  min-height: 42px;
}

.download-choice {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  cursor: pointer;
  display: grid;
  gap: 6px;
}

.download-choice span {
  color: var(--muted);
  font-weight: 700;
}

.download-choice.selected {
  border-color: var(--blue);
  background: #eaf3ff;
  box-shadow: 0 0 0 3px rgba(47,102,232,.10);
}

@media (max-width: 1180px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  .sidebar-footer {
    position: static;
    margin-top: 18px;
  }

  .app-shell {
    margin-left: 0;
    padding: 18px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-btn {
    white-space: nowrap;
  }

  .hero-card {
    padding: 32px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-meta {
    text-align: left;
  }

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

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

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

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

  .compact-form,
  .compact-form.equipment-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

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

  .panel, .hero-card, .modal {
    border-radius: 18px;
    padding: 18px;
  }

  .filter-grid,
  .filter-grid.compact,
  .form-grid,
  .compact-form,
  .compact-form.equipment-form {
    grid-template-columns: 1fr;
  }

  .span-2 { grid-column: span 1; }

  .panel-head, .modal-head {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .action-row {
    width: 100%;
  }
}

/* Professional compact refinement */
:root {
  --navy: #12345a;
  --navy-2: #0b1f36;
  --blue: #2563eb;
  --line: #d6e0ec;
  --soft: #f7f9fc;
  --soft-blue: #edf4fb;
  --text: #111827;
  --muted: #667085;
  --green: #e8f7ee;
  --green-border: #8ccfa6;
  --red: #fdeaea;
  --red-border: #f3a6a6;
  --shadow: 0 14px 34px rgba(15, 39, 71, .10);
  --radius: 16px;
}

html, body {
  background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
}

.sidebar {
  width: 214px;
  padding: 20px 16px;
}

.brand-title { font-size: 1.18rem; }
.brand-subtitle { font-size: .82rem; margin-top: 6px; }
.nav { gap: 6px; margin-top: 22px; }
.nav-btn { padding: 11px 13px; border-radius: 10px; font-size: .94rem; }

.app-shell {
  margin-left: 214px;
  padding: 18px 22px 48px;
}

.topbar { margin-bottom: 12px; }
.topbar h1 { font-size: 1.55rem; letter-spacing: -.02em; }
.utc-pill, .count-badge { padding: 5px 11px; font-size: .84rem; }

.status-banner {
  padding: 11px 14px;
  margin-bottom: 12px;
  font-size: .92rem;
}

.hero-card {
  min-height: 132px;
  padding: 28px 32px;
  border-radius: 20px;
  margin-bottom: 16px;
  background: linear-gradient(110deg, #10233d 0%, #1e4a8a 62%, #2d5aaa 100%);
}

.hero-card::after { opacity: .45; }
.hero-card h2 { font-size: clamp(1.65rem, 2.35vw, 2.5rem); }
.hero-card p { margin-top: 10px; font-size: .98rem; }
.hero-meta { font-size: .9rem; line-height: 1.45; }

.panel {
  border-radius: 18px;
  padding: 20px;
}

.panel-head { margin-bottom: 14px; }
.panel h2 { font-size: 1.35rem; }

.btn {
  min-height: 40px;
  border-radius: 11px;
  padding: 0 14px;
  font-size: .92rem;
  font-weight: 800;
}

.btn.compact {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: .82rem;
}

.metric-grid { gap: 12px; margin-bottom: 14px; }
.metric-card { padding: 14px 16px; border-radius: 14px; }
.metric-title { font-size: .86rem; }
.metric-value { margin-top: 6px; font-size: 1.55rem; }

.filter-card {
  padding: 12px;
  border-radius: 14px;
  background: #edf4fb;
  margin-bottom: 14px;
}

.filter-grid { gap: 9px; }
label { gap: 5px; font-size: .84rem; }
input, select {
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 700;
}

th {
  padding: 11px 12px;
  font-size: .76rem;
}

td {
  padding: 10px 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.icon-btn svg { width: 19px; height: 19px; }

.modal {
  border-radius: 20px;
  padding: 22px;
}

.modal h2 { font-size: 1.55rem; }
.wide-modal { width: min(1080px, 100%); }
.extra-wide-modal { width: min(1220px, 100%); }
.small-modal { width: min(560px, 100%); }

.form-card { padding: 16px; border-radius: 15px; margin: 16px 0; }
.form-grid { gap: 10px; }
.mini-summary { margin-top: 12px; }
.mini-summary span { padding: 6px 11px; font-size: .86rem; }

.equipment-list { gap: 10px; }
.equipment-group { border-radius: 14px; }
.equipment-group-head { padding: 10px 12px; font-size: .9rem; }
.equipment-row {
  grid-template-columns: 56px 1fr 126px minmax(180px, .75fr);
  gap: 10px;
  padding: 9px 12px;
}
.equipment-name { font-size: .92rem; }
.equipment-meta { font-size: .78rem; }
.status-toggle button { min-height: 36px; font-size: .84rem; }

.admin-section { border-radius: 14px; margin-top: 10px; }
.admin-section summary { padding: 12px 14px; }
.compact-form { padding: 12px; gap: 8px; }
.helper-text { padding: 0 12px 12px; font-size: .86rem; }
.admin-table-wrap { margin: 0 12px 12px; max-height: 390px; }
.admin-table-wrap input,
.admin-table-wrap select {
  min-width: 104px;
  padding: 8px 10px;
  min-height: 36px;
}

.row-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: nowrap;
}

.order-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: var(--navy);
  background: #f1f6fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: .82rem;
}

.inline-feedback {
  margin: 0 0 12px;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  border: 1px solid var(--green-border);
  background: var(--green);
  color: #166534;
}

.inline-feedback.error {
  border-color: var(--red-border);
  background: var(--red);
  color: #991b1b;
}

@media (max-width: 1180px) {
  .app-shell { margin-left: 0; }
}


.toast {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 300;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 18px 45px rgba(15, 39, 71, .18);
  font-weight: 850;
  line-height: 1.35;
}

.toast.success {
  border: 1px solid var(--green-border);
  background: #f0fbf4;
  color: #166534;
}

.toast.error {
  border: 1px solid var(--red-border);
  background: #fff1f1;
  color: #991b1b;
}

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