:root {
  --bg: #190a2c;
  --card: #190a2c;
  --ink: #ffffff;
  --muted: #d6d0e4;
  --accent: #5fd2c8;
  --accent-2: #f2b94b;
  --danger: #ff6b6b;
  --line: #3b2b57;
  --crystal-1: rgba(138, 98, 255, 0.35);
  --crystal-2: rgba(60, 255, 196, 0.18);
  --crystal-3: rgba(255, 214, 102, 0.18);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.page {
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 32px;
  margin: 0 0 6px 0;
}

.sub {
  margin: 0;
  color: var(--muted);
}

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

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

.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.actions form {
  margin: 0;
}

.card {
  background: var(--card);
  padding: 18px;
  border-radius: 0;
  box-shadow: var(--shadow);
  margin-bottom: 0;
  border: 1px solid var(--line);
}

.login-card {
  max-width: 520px;
  margin: 60px auto;
}

.card h2 {
  margin-top: 0;
}

.crystal-title {
  position: relative;
  padding: 10px 14px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(138, 98, 255, 0.35), rgba(60, 255, 196, 0.18), rgba(255, 214, 102, 0.18)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.08);
}

.crystal-title::after {
  content: "";
  position: absolute;
  inset: 6px 10px auto auto;
  width: 64px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  opacity: 0.5;
  pointer-events: none;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  margin-left: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 700;
}

.numbers-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.numbers-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.numbers-bar .crystal-title {
  padding: 6px 10px;
  font-size: 18px;
}

.numbers-bar .count-badge {
  height: 18px;
  min-width: 22px;
  padding: 0 6px;
  font-size: 11px;
}

.numbers-actions .btn {
  padding: 4px 8px;
  font-size: 11px;
}

.numbers-actions input[type="text"] {
  min-width: 180px;
  padding: 6px 10px;
  font-size: 12px;
}

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

.inline-form input[type="file"] {
  max-width: 220px;
}

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

.bulk-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.bulk-bar .bulk-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.bulk-bar select {
  min-width: 160px;
}

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

.grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

input,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: #22113a;
  color: var(--ink);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    background: var(--accent);
    color: #0c0a11;
    border-radius: 10px;
    border: none;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
  }
  .btn.active {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: 0 0 0 2px rgba(250, 232, 122, 0.2);
  }

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

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

.btn.tiny {
  padding: 6px 10px;
  font-size: 12px;
}

.btn.danger {
  background: var(--danger);
}

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

.import-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.import-row .import {
  flex: 1 1 320px;
}

.upload-status {
  display: none;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 100%;
  min-width: 240px;
}

.upload-status.active {
  display: flex;
}

.upload-status__text {
  font-size: 12px;
  color: var(--muted);
}

.upload-status__bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.upload-status__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.12s ease-out;
}

.hint {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search .date-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  position: relative;
}

.search .date-filter input[readonly] {
  cursor: pointer;
  min-width: 130px;
}

.search .date-picker-native {
  position: absolute;
  right: 0;
  bottom: -2px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 10px;
  align-items: start;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.filter-item.filter-item--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.filter-item .filter-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.filter-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.filter-item select,
.filter-item input[type="text"] {
  min-width: 160px;
  width: 100%;
}

.filter-item.duration-quick {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1a0d2f;
  grid-column: 1 / -1;
}

.filter-item.duration-quick .filter-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-item.duration-quick .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.filter-item.duration-quick .chip input {
  margin: 0;
}

.table-card {
  display: block;
}

.table-card > .crystal-title {
  width: 100%;
  margin: 0 0 12px 0;
}

.table-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.months-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  flex-wrap: wrap;
}

.months-bar-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.months-bar-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.months-hide-all.btn.tiny {
  padding: 2px 8px;
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}

.months-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.months-bar-name {
  font-size: 12px;
  color: var(--ink);
}

.device-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(95, 210, 200, 0.18);
  border: 1px solid rgba(95, 210, 200, 0.45);
  color: var(--ink);
  white-space: nowrap;
}

.table-scroll {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
}

#numbers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#numbers-table th,
#numbers-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

#numbers-table td.editable {
  cursor: pointer;
}

#numbers-table td.editable:hover {
  background: rgba(95, 210, 200, 0.08);
}

#numbers-table td.editable.editing {
  background: rgba(95, 210, 200, 0.14);
}

#numbers-table td.editable .inline-editor {
  width: 100%;
  min-width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

#numbers-table td.editable select.inline-editor {
  min-width: 160px;
}

#numbers-table .col-device-port {
  display: none;
}


#numbers-table th {
  cursor: pointer;
  background: #22113a;
  position: sticky;
  z-index: 2;
}

#numbers-table .sort-head {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

#numbers-table .sort-arrow {
  color: var(--accent-2);
  margin-left: 6px;
  font-size: 11px;
}

#numbers-table .quick-add-row td {
  background: rgba(95, 210, 200, 0.07);
}

#numbers-table .quick-add-row input,
#numbers-table .quick-add-row select {
  width: 100%;
  min-width: 130px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

#numbers-table .quick-add-row input[readonly] {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: default;
}

#numbers-table thead tr:first-child th {
  top: 0;
}

#numbers-table thead tr:nth-child(2) th {
  top: 42px;
  z-index: 1;
}

#numbers-table th.month-head,
#numbers-table th.month-sub {
  text-align: center;
}

#numbers-table th.month-head {
  background:
    linear-gradient(135deg, rgba(138, 98, 255, 0.28), rgba(60, 255, 196, 0.18), rgba(255, 214, 102, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#numbers-table th.month-sub {
  font-size: 12px;
}

.month-title {
  font-weight: 600;
  margin-right: 8px;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.month-title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.month-toggle-btn {
  padding: 4px 8px;
  font-size: 11px;
}

.month-cell {
  text-align: center;
  font-size: 12px;
}

.month-start {
  border-left: 1px solid #b3b3b3;
}

.month-end {
  border-right: 2px solid var(--line);
}

.month-range {
  white-space: nowrap;
}

#numbers-table tr:hover {
  background: #2b1a46;
}

#numbers-table tbody tr.is-selected {
  background: rgba(95, 210, 200, 0.18);
  box-shadow: inset 0 0 0 1px rgba(95, 210, 200, 0.45);
}

#numbers-table tbody tr.is-selected:hover {
  background: rgba(95, 210, 200, 0.22);
}

#numbers-table tbody tr.row-highlight {
  background: rgba(255, 210, 90, 0.28);
  transition: background 0.4s ease;
}

.center {
  text-align: center;
}

.actions-cell {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  border-left: 2px solid var(--line);
  padding-left: 12px;
}

.actions-cell .btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 8px;
  font-size: 11px;
}

.actions-cell .btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.actions-cell form {
  margin: 0;
  padding: 0;
  border: 0;
  display: inline-flex;
  align-items: center;
}

.actions-head {
  border-left: 2px solid var(--line);
}

.month-panel {
  flex: 0 0 180px;
  background: #1b0e2e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  position: sticky;
  top: 12px;
}

.month-panel-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.month-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
}

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

.month-panel-name {
  color: var(--muted);
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form code {
  font-size: 12px;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 12px;
}

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

.simple-table th {
  background: #22113a;
}

.simple-table tbody tr:hover {
  background: #2b1a46;
}

.compact-table th,
.compact-table td {
  padding: 6px 8px;
  font-size: 12px;
}

.col-hidden {
  display: none;
}

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

.filters--compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filters--compact .filter-item {
  padding: 6px 8px;
  font-size: 12px;
  min-width: 160px;
}

.filters--compact .filter-item.filter-item--stack {
  flex-direction: row;
  align-items: center;
}

.filters--compact .filter-title {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}

.filters--compact .filter-item select,
.filters--compact .filter-item input[type="text"],
.filters--compact .filter-item input[type="number"] {
  min-width: 120px;
  width: 120px;
}

.filters--compact .range-inputs input {
  width: 90px;
}

.filters--compact .btn.tiny {
  padding: 4px 8px;
  font-size: 11px;
}

.filters--compact .filter-actions {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 10px;
}

.weekday-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.weekday-title {
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
}

.portlist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portlist-device {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.portlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.portlist-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portlist-body {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.portlist-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 8px;
}

.portlist-label {
  font-weight: 600;
}

.portlist-input {
  width: 100%;
}

.portlist-device.collapsed .portlist-body {
  display: none;
}

.calllist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calllist-device {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.calllist-device-head,
.calllist-port-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.calllist-device-head {
  background: linear-gradient(90deg, rgba(42, 22, 70, 0.9), rgba(25, 12, 45, 0.9));
}

.calllist-port-head {
  background: rgba(255, 255, 255, 0.03);
}

.calllist-device-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calllist-port {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.calllist-port-body {
  padding: 10px;
}

.calllist-device.collapsed .calllist-device-body {
  display: none;
}

.calllist-port.collapsed .calllist-port-body {
  display: none;
}

.duration-red {
  color: #ff6b6b;
  font-weight: 700;
}

.duration-orange {
  color: #f2b94b;
  font-weight: 700;
}

.duration-green {
  color: #49d17d;
  font-weight: 700;
}

.calllist .simple-table tbody tr.calllist-row-selected,
.calllist .simple-table tbody tr.calllist-row-selected:hover {
  background: rgba(138, 98, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(184, 150, 255, 0.8);
}

@media (max-width: 760px) {
  .portlist-row {
    grid-template-columns: 1fr;
  }
  .portlist-label {
    margin-bottom: 4px;
  }
}

@media (max-width: 1200px) {
  .weekday-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .weekday-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

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

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

.section-head h2 {
  margin: 0;
}

.card.collapsed .section-body {
  display: none;
}

.card.collapsible {
  padding: 10px 12px;
}

.card.collapsible .section-head {
  margin-bottom: 0;
}

.card.collapsible .crystal-title {
  padding: 6px 10px;
  font-size: 18px;
}

.card.collapsible .section-toggle.btn.tiny {
  padding: 4px 8px;
  font-size: 11px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
}

.card.collapsed .section-body {
  display: none;
}

.danger-card {
  border: 1px solid #6a2b2b;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 4px;
  font-size: 11px;
  line-height: 1;
}

.pager-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.pager-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.pager-controls .page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pager-controls .page-jump input {
  width: 64px;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
}

.pager-controls select {
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
}

.pager .btn.tiny {
  padding: 3px 6px;
  font-size: 10px;
}

.pager-total {
  font-size: 13px;
  font-weight: 600;
}

.month-stat {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding: 4px 0;
  font-size: 12px;
}

.month-stat:last-child {
  border-bottom: none;
}

.month-stat .month {
  color: var(--muted);
  min-width: 72px;
}

.device-form {
  align-items: end;
}

.device-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.device-summary-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.ports-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toast {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.2);
  border: 1px solid rgba(255, 107, 107, 0.6);
  color: #ffd6d6;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.device-panel {
  border: 1px solid rgba(123, 97, 255, 0.4);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 8, 20, 0.6);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.3);
}

.location-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 12px;
}

.location-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(34, 19, 58, 0.9), rgba(24, 12, 46, 0.9));
  border-bottom: 1px solid var(--line);
}

.location-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
}

.location-title .muted {
  color: var(--muted);
  font-size: 12px;
}

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

.location-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.location-panel.collapsed .location-body {
  display: none;
}

.device-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(42, 22, 70, 0.9), rgba(25, 12, 45, 0.9));
  border-bottom: 1px solid rgba(123, 97, 255, 0.4);
}

.device-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
}

.device-title .muted {
  color: var(--muted);
  font-size: 12px;
}

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

.device-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.device-panel.collapsed .device-body {
  display: none;
}

.port-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.2);
}

.port-card.collapsed .table-scroll {
  display: none;
}

.port-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.port-header h3 {
  margin: 0;
  font-size: 16px;
}

.port-bulk-input {
  flex: 1 1 260px;
  min-width: 220px;
}

.port-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.port-table th,
.port-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.port-table th {
  background: #22113a;
}

.port-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.port-table thead tr:nth-child(2) th {
  top: 34px;
  z-index: 2;
}

.port-table input,
.port-table select {
  width: 100%;
  min-width: 140px;
}

.port-table .port-no-cell {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border-right: 1px solid var(--line);
  min-width: 80px;
}

.port-table .stat-head {
  text-align: center;
  background: linear-gradient(135deg, rgba(138, 98, 255, 0.35), rgba(60, 255, 196, 0.18));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.port-table .stat-sub {
  text-align: center;
  font-size: 12px;
}

.port-table .stat-cell {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.port-table tbody tr:hover {
  background: #2b1a46;
}

.portlist-row.is-copied {
  background: rgba(255, 210, 90, 0.22);
  border-radius: 10px;
}

/* Device stats group separators (Last Month | This Month) */
.port-table thead tr:first-child th.stat-head:first-of-type {
  border-left: 2px solid var(--line);
  border-right: 2px solid var(--line);
}

.port-table thead tr:first-child th.stat-head:last-of-type {
  border-right: 2px solid var(--line);
}

.port-table .stat-last-start,
.port-table td.stat-last-start {
  border-left: 2px solid var(--line);
}

.port-table .stat-last-end,
.port-table td.stat-last-end {
  border-right: 2px solid var(--line);
}

.port-table .stat-this-start,
.port-table td.stat-this-start {
  border-left: 2px solid var(--line);
}

.port-table .stat-this-end,
.port-table td.stat-this-end {
  border-right: 2px solid var(--line);
}

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

  .table-card {
    flex-direction: column;
  }

  .month-panel {
    position: static;
    width: 100%;
  }
}
