/* Fix2 Bill — Main Stylesheet */
:root {
  --bg: #0d0f14;
  --surface: #141720;
  --surface2: #1c2030;
  --surface3: #242840;
  --border: #2a2f45;
  --accent: #f5a623;
  --accent2: #3de8c0;
  --accent3: #e85c3d;
  --brand-name-color: #f5a623;
  --text: #e8eaf0;
  --muted: #6b7494;
  --muted2: #9aa0bb;
  --green: #3de8a0;
  --red: #e85c5c;
  --yellow: #f5c842;
  --blue: #4a9eff;
}

body.light {
  --bg: #f0f2f7;
  --surface: #ffffff;
  --surface2: #e8eaf2;
  --surface3: #dde0ed;
  --border: #c8cce0;
  --accent: #d4880a;
  --accent2: #0fa882;
  --accent3: #c0402a;
  --brand-name-color: #d4880a;
  --text: #1a1d2e;
  --muted: #7a80a0;
  --muted2: #4a5070;
  --green: #0fa870;
  --red: #c04040;
  --yellow: #c09010;
  --blue: #2a7edf;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Hide scrollbars globally */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 72px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  z-index: 100;
  gap: 6px;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 2px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  margin-bottom: 24px;
  line-height: 1;
  transition: none;
  position: relative;
}

/* Pin state indicator — small dot on the logo */
.sidebar-pin-dot {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  writing-mode: horizontal-tb;
}
.sidebar-pin-dot.locked-open   { opacity: 1; background: var(--accent); }
.sidebar-pin-dot.locked-closed { opacity: 1; background: var(--muted2); }

.nav-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
  position: relative;
}

.nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-btn:active {
  transform: scale(0.88);
  filter: brightness(0.72);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.nav-btn.active {
  background: var(--accent);
  color: #000;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

.nav-tooltip {
  position: absolute;
  left: 64px;
  background: var(--surface3);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border: 1px solid var(--border);
}

.nav-btn:hover .nav-tooltip {
  opacity: 1;
}

/* SIDEBAR EXPANDED */
.sidebar {
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.expanded {
  width: 200px;
  align-items: flex-start;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar.expanded .logo {
  font-size: 24px;
  margin-bottom: 24px;
  padding-left: 4px;
}

.sidebar.expanded .nav-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 12px;
}

.sidebar.expanded .nav-label {
  display: block;
}

.sidebar.expanded .nav-tooltip {
  display: none;
}

.nav-label {
  display: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.logo {
  cursor: pointer;
  user-select: none;
}

.main {
  margin-left: 72px;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

body.sidebar-expanded .main {
  margin-left: 200px;
}

/* TOP BAR */
.topbar {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--text);
}

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

.topbar-quick-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
}
.topbar-quick-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.topbar-quick-btn:active {
  transform: scale(0.91);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-family: 'Roboto Mono', monospace;
  color: var(--muted2);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

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

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #000;
}

/* CONTENT */
.content {
  padding: 32px;
}

/* VIEWS */
.view {
  display: none;
  width: 95%;
  margin: 0 auto;
}

.view.active {
  display: block;
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.orange::before {
  background: var(--accent);
}

.stat-card.teal::before {
  background: var(--accent2);
}

.stat-card.red::before {
  background: var(--accent3);
}

.stat-card.blue::before {
  background: var(--blue);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.orange .stat-value {
  color: var(--accent);
}

.stat-card.teal .stat-value {
  color: var(--accent2);
}

.stat-card.red .stat-value {
  color: var(--accent3);
}

.stat-card.blue .stat-value {
  color: var(--blue);
}

.stat-sub {
  font-size: 12px;
  color: var(--muted2);
}

/* GRID 2 COL */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--text);
}

.badge {
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.badge-orange {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent);
}

.badge-teal {
  background: rgba(61, 232, 192, 0.15);
  color: var(--accent2);
}

.badge-red {
  background: rgba(232, 92, 61, 0.15);
  color: var(--accent3);
}

.badge-blue {
  background: rgba(74, 158, 255, 0.15);
  color: var(--blue);
}

.badge-green {
  background: rgba(61, 232, 160, 0.15);
  color: var(--green);
}

/* TABLE */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 10px 24px;
  text-align: left;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.table td {
  padding: 14px 24px;
  font-size: 13px;
  border-bottom: 1px solid rgba(42, 47, 69, 0.5);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--surface2);
}

/* SCHEDULE ITEMS */
.schedule-item {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.15s;
  cursor: pointer;
}

.schedule-item:hover {
  background: var(--surface2);
}

.schedule-item:last-child {
  border-bottom: none;
}

.time-block {
  min-width: 70px;
  text-align: center;
}

.time-main {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: var(--accent2);
}

.time-day {
  font-size: 10px;
  font-family: 'Roboto Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
}

.schedule-bar {
  width: 3px;
  border-radius: 2px;
  align-self: stretch;
  min-height: 40px;
}

.bar-high {
  background: var(--accent3);
}

.bar-med {
  background: var(--accent);
}

.bar-low {
  background: var(--accent2);
}

.schedule-info {
  flex: 1;
}

.schedule-company {
  font-weight: 600;
  font-size: 14px;
}

.schedule-detail {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 2px;
}

/* INVENTORY */
.stock-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.fill-green {
  background: var(--green);
}

.fill-yellow {
  background: var(--yellow);
}

.fill-red {
  background: var(--red);
}

/* COMPANY CARDS */
.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  gap: 20px;
  position: relative;
}

.company-card-left {
  flex: 1;
  min-width: 0;
}

.company-card-right {
  width: 155px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.company-equip-title {
  font-size: 10px;
  font-family: 'Roboto Mono', monospace;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.company-equip-item {
  font-size: 11px;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.company-equip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.equip-ok {
  background: var(--green);
}

.equip-due {
  background: var(--yellow);
}

.equip-over {
  background: var(--red);
}

.company-card:hover {
  border-color: var(--accent2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.company-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  margin-bottom: 16px;
}

.company-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.company-industry {
  font-size: 12px;
  color: var(--muted2);
  margin-bottom: 16px;
}

.company-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  color: var(--muted2);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 6px;
}

/* MACHINE LIST */
.machine-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.machine-row:last-child {
  border-bottom: none;
}

.machine-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.machine-info {
  flex: 1;
}

.machine-name {
  font-weight: 500;
}

.machine-model {
  font-size: 11px;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
}

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: #ffb93a;
}
.btn-primary:active {
  transform: scale(0.94) translateY(2px);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.25);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.btn-ghost {
  background: transparent;
  color: var(--muted2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}
.btn-ghost:active {
  transform: scale(0.94) translateY(2px);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.20);
  filter: brightness(0.82);
  transition: transform 0.07s ease, filter 0.07s ease;
}

/* ADDRESS AUTOCOMPLETE */
.addr-autocomplete-wrap { position: relative; }

.addr-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  z-index: 9999;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 220px;
  overflow-y: auto;
}

.addr-suggestion-item {
  padding: 9px 13px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background 0.12s;
  line-height: 1.4;
}

.addr-suggestion-item:last-child { border-bottom: none; }

.addr-suggestion-item:hover,
.addr-suggestion-item.highlighted { background: var(--surface3); }

.addr-suggestion-icon { flex-shrink: 0; color: var(--accent); opacity: 0.75; }

.addr-loading {
  padding: 10px 13px;
  font-size: 12px;
  color: var(--muted2);
  font-family: 'Roboto Mono', monospace;
  display: flex; align-items: center; gap: 8px;
}

.addr-loading-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0.6;
  animation: addrPulse 1s infinite;
}

@keyframes addrPulse {
  0%,100% { opacity:0.6; transform:scale(1); }
  50%      { opacity:1;   transform:scale(1.3); }
}

/* COLLAPSIBLE ADMIN PANELS */
.admin-panel-body {
  display: none;
  overflow: hidden;
}
.admin-panel-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.admin-panel-toggle:hover {
  background: var(--surface3);
  color: var(--text);
}
.admin-panel-toggle:active {
  transform: scale(0.86);
  filter: brightness(0.75);
  transition: transform 0.07s ease, filter 0.07s ease;
}
.admin-panel-toggle svg {
  transition: transform 0.25s ease;
}
.admin-panel-open .admin-panel-toggle svg {
  transform: rotate(180deg);
}
.admin-panel-open > .card-header {
  border-bottom: 1px solid var(--border);
}
.card:not(.admin-panel-open) > .card-header {
  border-bottom: none;
}
.card-header {
  cursor: pointer;
  user-select: none;
}

/* SECTION HEADING */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal::-webkit-scrollbar {
  display: none;
}

.modal.modal-invoice {
  width: 720px;
  max-width: 94vw;
  max-height: 92vh;
}

.modal-shell {
  position: relative;
}

.modal-shell-wide .modal-x-btn {
  right: 12px;
}

.modal-x-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.modal-x-btn:hover {
  background: var(--surface3);
  border-color: var(--red);
  color: var(--red);
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 2px;
  margin-bottom: 24px;
  color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
  margin-bottom: 6px;
  display: block;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent);
}

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

/* NOTIFICATION */
.notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--accent2);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 13px;
  transform: translateY(80px);
  transition: transform 0.3s;
  z-index: 300;
  color: var(--accent2);
  font-family: 'Roboto Mono', monospace;
}

.notif.show {
  transform: translateY(0);
}

.notif.error {
  border-color: var(--red);
  color: var(--red);
  background: rgba(232, 92, 92, 0.08);
}

/* PRIORITY */
.priority-high {
  color: var(--red);
}

.priority-med {
  color: var(--yellow);
}

.priority-low {
  color: var(--green);
}

/* SEARCH */
.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  width: 16px;
  height: 16px;
}

.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  width: 220px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

/* ANIMATIONS */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* LOGIN OVERLAY */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 420px;
  max-width: 92vw;
}

.login-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 52px;
  color: var(--accent);
  letter-spacing: 4px;
  line-height: 1;
  margin-bottom: 8px;
}

.login-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 34px;
  letter-spacing: 3px;
  color: var(--text);
  margin-bottom: 4px;
}

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

.login-sub {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Roboto Mono', monospace;
  margin-bottom: 36px;
}

.login-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 14px;
  display: none;
  font-family: 'Roboto Mono', monospace;
}

.login-hint {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-family: 'Roboto Mono', monospace;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  line-height: 1.8;
}

/* ROLE BADGE */
.role-badge {
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(74, 158, 255, 0.15);
  color: var(--blue);
}

.role-badge.admin {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted2);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.logout-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.logout-btn:active {
  transform: scale(0.90);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface2);
}
.theme-toggle:active {
  transform: scale(0.88);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: opacity 0.15s;
}

.btn-delete {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.btn-delete:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-delete:active {
  transform: scale(0.90);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

.btn-delete--card {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  transition: opacity 0.15s;
}

.company-card:hover .btn-delete--card {
  opacity: 1;
}

/* MACHINE TYPE PANEL */
.mtype-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.mtype-brand-row:hover {
  background: var(--surface2);
}

.mtype-chevron {
  width: 14px;
  height: 14px;
  min-width: 14px;
  color: var(--muted);
  transition: transform 0.2s;
}

.mtype-brand-row.open .mtype-chevron {
  transform: rotate(90deg);
}

.mtype-brand-name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.mtype-model-count {
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  color: var(--muted2);
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.mtype-models-wrap {
  padding: 10px 24px 14px 52px;
  border-bottom: 1px solid var(--border);
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--surface2);
}

.mtype-models-wrap.open {
  display: flex;
}

.mtype-model-chip {
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--muted2);
  padding: 4px 10px;
  border-radius: 20px;
}

.model-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.btn-remove-model {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-remove-model:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* INTERVAL CHIPS */
.interval-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface3);
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.interval-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.interval-chip.selected {
  border-color: var(--accent);
  background: rgba(245, 166, 35, 0.12);
  color: var(--accent);
}
/* CLOCK PICKER */
.clock-input {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: 'Roboto Mono', monospace; font-size: 13px; letter-spacing: 1px;
  cursor: pointer; transition: border-color 0.15s; user-select: none;
  box-sizing: border-box;
}
.clock-input:not(.cp-ro):hover { border-color: var(--accent); }
.clock-input.cp-ro { opacity: 0.65; cursor: not-allowed; pointer-events: none; }

/* =====================================================================
   MOBILE RESPONSIVE — max-width: 768px
   Sidebar becomes a fixed bottom nav bar. Desktop layout unchanged.
====================================================================== */
@media (max-width: 768px) {

  /* --- Sidebar → Bottom Nav --- */
  .sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 58px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center !important;
    padding: 0 4px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    border-right: none;
    border-top: 1px solid var(--border);
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    transition: none !important;
  }

  /* Prevent hover-expand on mobile */
  .sidebar.expanded {
    width: 100% !important;
    align-items: center !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    flex-direction: row !important;
  }
  .sidebar.expanded .nav-btn {
    width: 44px !important;
    height: 44px !important;
    justify-content: center !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  .sidebar.expanded .nav-label { display: none !important; }
  .sidebar.expanded .logo { display: none !important; }

  .logo { display: none !important; }

  .nav-btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .nav-btn[style*="margin-top:auto"] { margin-top: 0 !important; }
  .nav-tooltip { display: none !important; }
  .nav-label { display: none !important; }

  /* --- Main content: remove left margin, add bottom padding --- */
  .main {
    margin-left: 0 !important;
    padding-bottom: 66px;
  }
  body.sidebar-expanded .main {
    margin-left: 0 !important;
  }

  /* --- Topbar --- */
  .topbar {
    padding: 10px 14px;
  }
  .topbar-title {
    font-size: 20px;
    letter-spacing: 1px;
  }
  .topbar-right {
    gap: 8px;
  }
  .status-pill { display: none; }
  .logout-btn {
    padding: 5px 9px;
    font-size: 11px;
  }
  .role-badge { display: none; }

  /* --- Content padding --- */
  .content {
    padding: 14px;
  }

  /* --- Stats row: 2 columns on mobile --- */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px 16px;
  }
  .stat-value {
    font-size: 32px;
  }

  /* --- Grids: single column --- */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* --- Cards --- */
  .card {
    overflow-x: auto;
    border-radius: 12px;
  }
  .card-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- Tables: horizontal scroll --- */
  .table th,
  .table td {
    padding: 10px 14px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* --- Section headers --- */
  .section-head {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  .section-title {
    font-size: 18px;
  }

  /* --- Modals: near full screen --- */
  .modal {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 88vh !important;
    padding: 20px 16px !important;
    border-radius: 16px !important;
  }
  .modal.modal-invoice {
    width: 96vw !important;
    max-width: 96vw !important;
  }
  .modal-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  /* --- Schedule items --- */
  .schedule-item {
    padding: 12px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }

  /* --- Forms inside modals --- */
  .form-input,
  .form-select {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  /* --- Inline grids used in views (style attributes) --- */
  [style*="display:grid"],
  [style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* Very small screens: stat cards single column */
@media (max-width: 420px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-value { font-size: 26px; }
  .stat-label { font-size: 9px; }
  .topbar-title { font-size: 17px; }
}
/* Upcoming jobs — locked grid columns */
#dash-upcoming-list .schedule-item {
  display: grid;
  grid-template-columns: 90px 3px minmax(0, 1fr) 80px 100px 100px;
  align-items: center;
  gap: 12px;
}

/* Force each child into its explicit column — no ambiguity */
/* ── Schedule list: 7 columns (time | bar | info | priority | status | timer | action) */
#schedule-list .schedule-item {
  display: grid;
  grid-template-columns: 90px 3px minmax(0, 1fr) 80px 100px 110px;
  align-items: center;
  gap: 12px;
}
#schedule-list .schedule-item > *:nth-child(1) { grid-column: 1; }
#schedule-list .schedule-item > *:nth-child(2) { grid-column: 2; }
#schedule-list .schedule-item > *:nth-child(3) { grid-column: 3; }
#schedule-list .schedule-item > *:nth-child(4) { grid-column: 4; }
#schedule-list .schedule-item > *:nth-child(5) { grid-column: 5; }
#schedule-list .schedule-item > *:nth-child(6) { grid-column: 6; }
#schedule-list .schedule-item .badge { text-align: center; }
#schedule-list .schedule-item > *:nth-child(6) { width: 100%; justify-content: center; }

/* ── Dashboard upcoming jobs: 6 columns (time | bar | info | priority | status | invoice) */
#dash-upcoming-list .schedule-item {
  display: grid;
  grid-template-columns: 90px 3px minmax(0, 1fr) 80px 100px 100px;
  align-items: center;
  gap: 12px;
}
#dash-upcoming-list .schedule-item > *:nth-child(1) { grid-column: 1; }
#dash-upcoming-list .schedule-item > *:nth-child(2) { grid-column: 2; }
#dash-upcoming-list .schedule-item > *:nth-child(3) { grid-column: 3; }
#dash-upcoming-list .schedule-item > *:nth-child(4) { grid-column: 4; }
#dash-upcoming-list .schedule-item > *:nth-child(5) { grid-column: 5; }
#dash-upcoming-list .schedule-item > *:nth-child(6) { grid-column: 6; }
#dash-upcoming-list .schedule-item .badge  { text-align: center; }
#dash-upcoming-list .schedule-item > button { width: 100%; justify-content: center; }

/* Shared sizing */
#schedule-list .time-block,
#dash-upcoming-list .time-block   { width: 90px; }
#schedule-list .schedule-bar,
#dash-upcoming-list .schedule-bar { width: 3px; }
#schedule-list .schedule-info,
#dash-upcoming-list .schedule-info { min-width: 0; }

/* =====================================================================
   MOBILE ENHANCEMENTS v2 — Additional rules for max-width: 768px
   These extend the existing mobile block above.
====================================================================== */
@media (max-width: 768px) {

  /* --- Topbar: hide quick-link buttons & refresh timestamp --- */
  .topbar-quick-btn {
    display: none !important;
  }
  #last-refreshed-label {
    display: none !important;
  }

  /* --- Search inputs: stretch to fill available space --- */
  .search-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }
  .search-input {
    width: 100%;
    min-width: 100px;
  }

  /* --- Section head: allow multi-line wrapping --- */
  .section-head > div {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* --- Staff map: lower height on small screens --- */
  #staff-map-container {
    height: 240px !important;
  }

  /* --- Company cards: hide right equipment panel on mobile --- */
  .company-card-right {
    display: none !important;
  }
  .company-card {
    flex-direction: column;
  }

  /* --- Inline filter rows inside card-headers: allow wrap --- */
  .card-header > div,
  .card-header > span {
    flex-wrap: wrap;
  }

  /* ─────────────────────────────────────────────────────────────────
     Schedule items — 2-row card layout for mobile
     Row 1: [time (spans rows) | company info (full width)]
     Row 2: [time (cont.)      | priority | status | action]
     ───────────────────────────────────────────────────────────────── */
  #schedule-list .schedule-item,
  #dash-upcoming-list .schedule-item {
    display: grid !important;
    grid-template-columns: 62px 1fr 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 4px 8px !important;
    align-items: center !important;
    padding: 12px 14px !important;
  }

  /* time-block: spans both rows in column 1 */
  #schedule-list .schedule-item > *:nth-child(1),
  #dash-upcoming-list .schedule-item > *:nth-child(1) {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    width: auto !important;
    min-width: auto !important;
    align-self: center !important;
  }

  /* vertical bar: hide on mobile */
  #schedule-list .schedule-item > *:nth-child(2),
  #dash-upcoming-list .schedule-item > *:nth-child(2) {
    display: none !important;
  }

  /* info block: row 1, spans columns 2–4 */
  #schedule-list .schedule-item > *:nth-child(3),
  #dash-upcoming-list .schedule-item > *:nth-child(3) {
    grid-column: 2 / 5 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    width: auto !important;
  }

  /* priority: row 2, col 2 */
  #schedule-list .schedule-item > *:nth-child(4),
  #dash-upcoming-list .schedule-item > *:nth-child(4) {
    grid-column: 2 !important;
    grid-row: 2 !important;
    width: auto !important;
    justify-content: flex-start !important;
    font-size: 10px !important;
    padding: 2px 5px !important;
  }

  /* status badge: row 2, col 3 */
  #schedule-list .schedule-item > *:nth-child(5),
  #dash-upcoming-list .schedule-item > *:nth-child(5) {
    grid-column: 3 !important;
    grid-row: 2 !important;
    width: auto !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    padding: 2px 5px !important;
  }

  /* action button / timer: row 2, col 4 */
  #schedule-list .schedule-item > *:nth-child(6),
  #dash-upcoming-list .schedule-item > *:nth-child(6) {
    grid-column: 4 !important;
    grid-row: 2 !important;
    width: auto !important;
    justify-content: flex-end !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
  }

  /* override shared sizing for mobile */
  #schedule-list .time-block,
  #dash-upcoming-list .time-block {
    width: auto !important;
    min-width: 0 !important;
  }
  #schedule-list .schedule-bar,
  #dash-upcoming-list .schedule-bar {
    width: 0 !important;
  }

  /* time values: slightly smaller on mobile */
  .time-main { font-size: 17px; }
  .time-day  { font-size: 9px; }

  /* --- Machine rows: tighter on mobile --- */
  .machine-row {
    padding: 10px 14px;
  }

  /* --- Notification toast: full-width on mobile --- */
  .notif {
    left: 14px;
    right: 14px;
    bottom: 72px; /* above bottom nav */
    /* Hidden state: slide far enough to clear navbar + toast height */
    transform: translateY(calc(100% + 90px));
  }

  /* Visible state stays unchanged */
  .notif.show {
    transform: translateY(0);
  }

  /* --- Modal overlay: push up above bottom nav --- */
  .modal-overlay {
    padding-bottom: 60px;
  }
}

/* ─── Very small phones (≤ 380px) ─────────────────────────────────── */
@media (max-width: 380px) {
  /* Schedule items: 3-column layout (drop the last action col if too tight) */
  #schedule-list .schedule-item,
  #dash-upcoming-list .schedule-item {
    grid-template-columns: 56px 1fr 1fr !important;
  }

  /* action wraps under priority + status */
  #schedule-list .schedule-item > *:nth-child(6),
  #dash-upcoming-list .schedule-item > *:nth-child(6) {
    grid-column: 2 / 4 !important;
    grid-row: 3 !important;
    justify-content: flex-start !important;
  }

  .topbar-title { font-size: 16px !important; }
  .avatar { width: 30px; height: 30px; font-size: 12px; }
}


/* ═══════════════════════════════════════════════════════════════════
   Universal button :active fallback + filter chips
   ═══════════════════════════════════════════════════════════════════ */

button:active,
[role="button"]:active,
.filter-chip:active,
.chip:active,
.tag-btn:active,
.icon-btn:active,
.share-btn:active,
.map-btn:active {
  transform: scale(0.90);
  filter: brightness(0.78);
  transition: transform 0.07s ease, filter 0.07s ease;
}

/* ═══════════════════════════════════════════════════════════════════
   Operation Blocking Popup
   ═══════════════════════════════════════════════════════════════════ */

#op-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#op-popup-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
#op-popup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  min-width: 220px;
  max-width: 340px;
  text-align: center;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0,0,0,0.40);
  transform: scale(0.90);
  transition: transform 0.18s ease;
}
#op-popup-overlay.show #op-popup-box {
  transform: scale(1);
}
#op-popup-msg {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════
   Centered Confirm Dialog
   ═══════════════════════════════════════════════════════════════════ */

.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.confirm-dialog-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.confirm-dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  transform: scale(0.88);
  transition: transform 0.18s ease;
}
.confirm-dialog-overlay.show .confirm-dialog-box {
  transform: scale(1);
}
#confirm-dialog-msg {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.confirm-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-dialog-actions .btn {
  min-width: 80px;
}
@media (max-width: 768px) {
  .confirm-dialog-box {
    max-width: calc(100% - 32px);
    padding: 24px 20px 20px;
  }
  .confirm-dialog-actions {
    flex-direction: column-reverse;
  }
  .confirm-dialog-actions .btn {
    width: 100%;
    text-align: center;
  }
}
