:root {
  --header: #eeeeee;
  --header-dark: #222;
  --panel: #f8f8f8;
  --work: #d8d8d8;
  --line: #b8b8b8;
  --line-soft: #d0d0d0;
  --text: #000;
  --muted: #555;
  --blue: #1f6fb8;
  --green: #18a64a;
  --orange: #f08a00;
  --red: #d22;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--work);
  font-family: Tahoma, Arial, sans-serif;
  font-size: 12px;
}
a { color: #064f9e; text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
  height: 41px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 6px;
  background: linear-gradient(#f9f9f9, #dadada);
  border-top: 4px solid var(--header-dark);
  border-bottom: 1px solid #aaa;
}
.brand-box {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 150px;
  font-weight: 700;
}
.brand-box img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #cfcfcf;
}
.main-menu { display: flex; align-items: center; gap: 0; }
.main-menu a {
  color: #111;
  padding: 7px 10px;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}
.main-menu a:hover {
  background: #fff;
  border-color: #bbb;
  text-decoration: none;
}
.main-menu a::after { content: "  "; }

.tabbar {
  height: 26px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding-left: 4px;
  background: linear-gradient(#e7e7e7, #d0d0d0);
  border-bottom: 1px solid #aaa;
}
.tab {
  height: 23px;
  min-width: 130px;
  padding: 5px 12px 3px;
  border: 1px solid #aaa;
  border-bottom: none;
  background: #e9e9e9;
  font-weight: 700;
}
.tab.active { background: #fff; }

.workspace {
  min-height: calc(100vh - 67px);
  display: grid;
  grid-template-columns: 154px 1fr;
}
.actions {
  padding: 6px;
  background: #efefef;
  border-right: 1px solid #bbb;
}
.tool {
  display: flex;
  align-items: center;
  min-height: 26px;
  width: 100%;
  margin: 0 0 6px;
  padding: 3px 8px;
  font-weight: 700;
  color: #333;
  border: 1px solid #888;
  background: linear-gradient(#fff, #ddd);
}
.tool.primary {
  color: #073f78;
  border-color: #6e9dc8;
  background: linear-gradient(#eef7ff, #cfe4f8);
}
.tool.danger {
  color: #8b1111;
  border-color: #b66;
  background: linear-gradient(#fff, #f0c7c7);
}
.tool:hover { text-decoration: none; border-color: #333; }
.content {
  overflow: auto;
  background: #fff;
  min-width: 0;
}

.messages { padding: 5px; }
.message {
  padding: 5px 8px;
  background: #fff7cf;
  border: 1px solid #d8c36a;
}
.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 6px 8px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--line);
}
.status-pill {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #aaa;
  background: #fff;
  font-weight: 700;
}
.status-pill.ok {
  color: #0b7a2a;
  border-color: #88be99;
  background: #eef9f0;
}
.status-pill.warn {
  color: #8a5200;
  border-color: #d8b26e;
  background: #fff8e7;
}
.status-pill.off {
  color: #777;
  background: #f1f1f1;
}
.status-pill.muted {
  color: #666;
  border-color: #c4c9cf;
  background: #f5f7f9;
}
.status-pill.bad {
  color: #9b1111;
  border-color: #d09191;
  background: #fff0f0;
}

.filter-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: #f3f3f3;
  border-bottom: 1px solid var(--line);
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  background: #fff;
}
.grid-table.narrow { max-width: 1100px; }
.grid-table th,
.grid-table td {
  padding: 3px 5px;
  border-right: 1px solid #c8c8c8;
  border-bottom: 1px solid #c8c8c8;
  white-space: nowrap;
  vertical-align: top;
}
.grid-table th {
  background: linear-gradient(#f7f7f7, #e4e4e4);
  font-weight: 700;
  text-align: left;
}
.grid-table.sortable th.sortable-head { cursor: pointer; }
.grid-table.sortable th.sortable-head::after {
  content: attr(data-sort-label);
  color: var(--muted);
}
.grid-table tbody tr:nth-child(even) { background: #f2f2f2; }
.grid-table tbody tr:hover { background: #fffbdc; }
.grid-table tbody tr.current-row { background: #eaf8ee; }
.grid-table tbody tr.row-ok { background: #eef9f0; }
.grid-table tbody tr.row-alert,
.grid-table tbody tr.row-offline { background: #fff0f0; }
.grid-table tbody tr.row-online { background: #eef9f0; }
.grid-table .filters th {
  color: var(--muted);
  font-weight: 400;
  background: #fafafa;
}

.clip-cell {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-cell-wrap {
  white-space: normal;
  display: -webkit-box;
  max-height: 2.8em;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.is-hidden-column {
  display: none !important;
}
.table-config-panel {
  max-width: 620px;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f7f7f7;
}
.table-config-head,
.table-config-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.table-config-head {
  margin-bottom: 8px;
}
.table-config-actions {
  justify-content: flex-end;
  margin-top: 8px;
}
.table-config-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 10px;
}
.table-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 6px;
}
.table-config-check {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.table-config-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-config-width {
  width: 82px;
  min-height: 24px;
}

.customers-table,
.dashboard-table {
  table-layout: fixed;
}
.customers-table td,
.dashboard-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.customers-table .col-id { width: 4%; }
.customers-table .col-name { width: 24%; }
.customers-table .col-inn { width: 10%; }
.customers-table .col-control { width: 13%; }
.customers-table .col-balance { width: 10%; }
.customers-table .col-contact { width: 13%; }
.customers-table .col-phone { width: 11%; }
.customers-table .col-address { width: 15%; }
.customers-table .status-pill {
  margin-bottom: 2px;
}

.dashboard-table .col-service { width: 11%; }
.dashboard-table .col-graph { width: 4%; }
.dashboard-table .col-nas { width: 7%; }
.dashboard-table .col-partner { width: 8%; }
.dashboard-table .col-type { width: 5%; }
.dashboard-table .col-status { width: 6%; }
.dashboard-table .col-online { width: 6%; }
.dashboard-table .col-ping { width: 5%; }
.dashboard-table .col-mac { width: 8%; }
.dashboard-table .col-ip { width: 7%; }
.dashboard-table .col-speed { width: 5%; }
.dashboard-table .col-traffic { width: 10%; }
.dashboard-table .col-inn { width: 7%; }
.dashboard-table .col-customer { width: 11%; }
.dashboard-table .small-button {
  min-width: 0;
  width: 100%;
  justify-content: center;
  overflow: hidden;
  padding-left: 4px;
  padding-right: 4px;
  text-overflow: ellipsis;
}
.dashboard-table .dashboard-graph-link {
  display: inline-block;
  max-width: 100%;
  padding: 1px 6px;
  border: 1px solid #9ebbd8;
  border-radius: 999px;
  background: #e8f3ff;
  color: #075496;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: baseline;
  white-space: nowrap;
}
.dashboard-table .dashboard-graph-link:hover {
  background: #dcedff;
  text-decoration: none;
}

.payment-import-table {
  table-layout: fixed;
}
.payment-import-table .col-status { width: 108px; }
.payment-import-table .col-contract { width: 190px; }
.payment-import-table .col-amount { width: 118px; }
.payment-import-table .col-inn { width: 112px; }
.payment-import-table .col-customer { width: 220px; }
.payment-import-table .col-purpose { width: auto; }
.payment-import-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.payment-import-table .payment-import-contract .field {
  width: 100%;
  min-width: 0;
}
.payment-import-table .payment-import-amount {
  text-align: right;
}
.payment-import-table .payment-import-purpose {
  display: -webkit-box;
  max-height: 2.8em;
  overflow: hidden;
  line-height: 1.4;
  white-space: normal;
  cursor: help;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.grid-table tbody tr.payment-import-created,
.grid-table tbody tr.payment-import-created:nth-child(even) {
  background: #e9f8ec;
}
.grid-table tbody tr.payment-import-contract-missing,
.grid-table tbody tr.payment-import-contract-missing:nth-child(even) {
  background: #ffeef2;
}
.grid-table tbody tr.payment-import-muted,
.grid-table tbody tr.payment-import-muted:nth-child(even) {
  background: #eeeeee;
}

.edit-layout {
  display: grid;
  grid-template-columns: 408px 408px 408px;
  align-items: start;
  gap: 6px;
  padding: 8px;
}
.fieldset {
  padding: 8px 10px 10px;
  border: 1px solid #aeb9c9;
  background: #fbfbfb;
}
.fieldset.wide { grid-column: span 2; }
.fieldset h2,
.section-title {
  margin: 0 0 8px;
  font-size: 13px;
}
.form-row {
  display: grid;
  grid-template-columns: 105px 1fr;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}
.form-row label { text-align: left; }
.field,
input.field,
select.field,
textarea.field {
  width: 100%;
  min-height: 22px;
  padding: 2px 4px;
  border: 1px solid #aeb9c9;
  background: #fff;
  font: inherit;
}
textarea.field { min-height: 58px; resize: vertical; }
input[type="checkbox"].field {
  width: auto;
  min-height: auto;
}
.field-error {
  grid-column: 2;
  color: var(--red);
}
.field-help {
  grid-column: 2;
  margin-top: -4px;
  color: var(--muted);
  font-size: 11px;
}
.required-star {
  color: var(--red);
  font-weight: 700;
  cursor: help;
}
.form-actions {
  grid-column: 1 / -1;
  padding-top: 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  min-height: 24px;
  padding: 3px 12px;
  border: 1px solid #888;
  background: linear-gradient(#fff, #ddd);
  color: #111;
  font: inherit;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
}
.small-button.primary {
  background: linear-gradient(#e7f1ff, #bdd8f2);
  border-color: #6e9dc8;
}
.small-button.danger {
  background: linear-gradient(#fff, #f0c7c7);
  border-color: #b66;
}
.small-button:hover { text-decoration: none; }
.inline-form {
  display: inline;
  margin: 0;
}
.inline-form .tool { width: 100%; }
.compact-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 5px 8px;
  margin: 0;
  align-items: start;
}
.compact-dl dt { color: var(--muted); }
.compact-dl dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.tariff-actions {
  margin-top: 10px;
  padding-top: 8px;
}
.section-title { padding: 8px 8px 4px; }

.portal-page {
  min-height: calc(100vh - 41px);
  padding: 10px;
  background: #fff;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: #f7f7f7;
}
.detail-head h1 {
  margin: 0 0 4px;
  font-size: 18px;
}
.detail-head p { margin: 0; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid #b8b8b8;
  background: #fff;
  white-space: nowrap;
}
.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 8px;
}
.panel {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fbfbfb;
}
.panel h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #e1e1e1;
}
.login-box {
  width: 360px;
  background: #fff;
  border: 1px solid #999;
  padding: 14px;
}
.login-box h1 { margin: 0 0 12px; font-size: 16px; }
.login-box label { display: block; margin-bottom: 8px; }
.login-box input {
  width: 100%;
  margin-top: 3px;
  padding: 4px;
  border: 1px solid #aeb9c9;
}
button { font: inherit; }
.error { color: var(--red); }
.online-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: middle;
}
.online-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 1px #0d7e32 inset;
}
.online-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 1px #9b1111 inset;
}
.balance-debt { color: var(--red); font-weight: 700; }
.balance-advance { color: var(--green); font-weight: 700; }
.warning-text { color: #9b1111; font-weight: 700; }
.account-state {
  margin-bottom: 8px;
  font-size: 14px;
}
.account-state strong { margin-left: 6px; }

.traffic-chart-panel {
  position: relative;
  margin: 8px 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fbfbfb;
}
.traffic-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.traffic-chart-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 8px;
}
.traffic-chart-title span { color: var(--muted); }
.portal-traffic-chart + .portal-traffic-chart { margin-top: 12px; }
.traffic-range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.traffic-date-filter {
  display: none;
  align-items: center;
  gap: 6px;
}
.traffic-date-filter.is-visible { display: inline-flex; }
.traffic-date-filter .field { width: 150px; }
.traffic-chart-status { color: var(--muted); }
.traffic-chart-wrap {
  position: relative;
  min-height: 260px;
  background: #242424;
  border: 1px solid #444;
  overflow: hidden;
}
.traffic-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 320px;
}
.traffic-tooltip {
  position: absolute;
  z-index: 3;
  max-width: 240px;
  padding: 6px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  pointer-events: none;
  line-height: 1.35;
}
.traffic-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted);
}
.traffic-chart-legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 5px;
  vertical-align: middle;
}
.traffic-chart-legend .legend-in::before { background: #1aa21a; }
.traffic-chart-legend .legend-out::before { background: #1b87d8; }

.resource-chart-panel {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.resource-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.resource-chart-head span {
  color: var(--muted);
}
.resource-chart-wrap {
  position: relative;
  min-height: 240px;
  border-radius: 5px;
  overflow: hidden;
  background: #242424;
}
.resource-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 260px;
}
.resource-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.resource-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.resource-chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
}
.resource-metrics-table td {
  white-space: nowrap;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  padding: 8px;
}
.menu-tile {
  display: block;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fbfbfb;
  color: var(--text);
}
.menu-tile:hover {
  border-color: #777;
  background: #fff;
  text-decoration: none;
}
.menu-tile b {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}
.menu-tile span {
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .tool { width: auto; margin: 0; }
  .edit-layout { grid-template-columns: 1fr; }
  .fieldset.wide { grid-column: auto; }
  .main-menu { overflow-x: auto; }
  .grid.two { grid-template-columns: 1fr; }
}

/* Operator console theme. The legacy/native theme is the base CSS above. */
html.theme-modern {
  --console-sidebar: #f4f6f8;
  --console-sidebar-strong: #e8edf2;
  --console-page: #eef1f4;
  --console-surface: #fff;
  --console-line: #d6dce3;
  --console-line-strong: #aeb8c4;
  --console-text: #17202a;
  --console-muted: #5c6672;
  --console-blue: #0d5ea8;
  --console-blue-soft: #e8f2fb;
  --console-green: #167a3c;
  --console-red: #b42318;
  --console-warn: #9a5b00;
  --console-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

html.theme-modern body {
  min-height: 100vh;
  background: var(--console-page);
  color: var(--console-text);
  font-family: Arial, Tahoma, sans-serif;
  font-size: 13px;
}

html.theme-modern .app-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 248px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 14px 12px;
  background: var(--console-sidebar);
  border: 0;
  border-right: 1px solid var(--console-line);
  box-shadow: none;
}

html.theme-modern .brand-box {
  min-width: 0;
  height: 42px;
  padding: 5px 6px;
  gap: 9px;
  color: var(--console-text);
}

html.theme-modern .brand-box img {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
}

html.theme-modern .brand-box strong {
  font-size: 16px;
}

html.theme-modern .main-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}

html.theme-modern .main-menu a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--console-text);
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}

html.theme-modern .main-menu a::after {
  content: "";
}

html.theme-modern .main-menu a:hover,
html.theme-modern .main-menu a.is-current {
  background: var(--console-blue-soft);
  border-color: #c4dbef;
  color: #064b87;
  text-decoration: none;
}

html.theme-modern .theme-toggle {
  margin-top: auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--console-line-strong);
  border-radius: 6px;
  background: var(--console-surface);
  color: var(--console-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

html.theme-modern .theme-toggle:hover {
  border-color: var(--console-blue);
}

html.theme-modern .tabbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  margin-left: 248px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  background: var(--console-surface);
  border: 0;
  border-bottom: 1px solid var(--console-line);
  box-shadow: var(--console-shadow);
}

html.theme-modern .tab {
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--console-text);
  font-size: 18px;
  font-weight: 700;
}

html.theme-modern .workspace {
  min-height: calc(100vh - 54px);
  margin-left: 248px;
  display: block;
}

html.theme-modern .actions {
  position: sticky;
  top: 54px;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(238, 241, 244, 0.96);
  border: 0;
  border-bottom: 1px solid var(--console-line);
  backdrop-filter: blur(8px);
}

html.theme-modern .tool,
html.theme-modern .small-button {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--console-line-strong);
  border-radius: 6px;
  background: var(--console-surface);
  color: var(--console-text);
  box-shadow: none;
}

html.theme-modern .tool.primary,
html.theme-modern .small-button.primary {
  color: #fff;
  border-color: var(--console-blue);
  background: var(--console-blue);
}

html.theme-modern .tool.danger,
html.theme-modern .small-button.danger {
  color: var(--console-red);
  border-color: #e6a19a;
  background: #fff5f4;
}

html.theme-modern .tool:hover,
html.theme-modern .small-button:hover {
  border-color: var(--console-blue);
  text-decoration: none;
}

html.theme-modern .dashboard-table .dashboard-graph-link {
  padding: 1px 6px;
  border-color: #8fb6da;
  border-radius: 999px;
  background: #e8f3ff;
  color: #075496;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

html.theme-modern .dashboard-table .dashboard-graph-link:hover {
  background: #dcedff;
  text-decoration: none;
}

html.theme-modern .content {
  min-height: calc(100vh - 108px);
  padding: 14px 18px 24px;
  overflow: visible;
  background: transparent;
}

html.theme-modern .messages {
  padding: 0 0 10px;
}

html.theme-modern .message {
  padding: 9px 12px;
  border: 1px solid #e5c85e;
  border-radius: 6px;
  background: #fff8d7;
}

html.theme-modern .summary-line,
html.theme-modern .filter-panel,
html.theme-modern .detail-head,
html.theme-modern .panel,
html.theme-modern .table-config-panel,
html.theme-modern .fieldset,
html.theme-modern .menu-tile,
html.theme-modern .traffic-chart-panel,
html.theme-modern .resource-chart-panel {
  border: 1px solid var(--console-line);
  border-radius: 6px;
  background: var(--console-surface);
  box-shadow: var(--console-shadow);
}

html.theme-modern .summary-line {
  margin-bottom: 10px;
  padding: 10px 12px;
  gap: 12px 20px;
}

html.theme-modern .filter-panel {
  margin-bottom: 10px;
  padding: 10px 12px;
}

html.theme-modern .grid-table {
  border-collapse: collapse;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

html.theme-modern .grid-table th,
html.theme-modern .grid-table td {
  padding: 5px 8px;
  border-right: 1px solid var(--console-line);
  border-bottom: 1px solid var(--console-line);
  background-clip: padding-box;
  line-height: 1.35;
}

html.theme-modern .grid-table th {
  position: static;
  background: #f6f8fa;
  color: var(--console-muted);
  font-size: 12px;
  text-transform: none;
}

html.theme-modern .grid-table .filters th {
  position: static;
  background: #fafafa;
  color: var(--console-muted);
  font-weight: 400;
}

html.theme-modern .grid-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

html.theme-modern .grid-table tbody tr:hover {
  background: #fff8d9;
}

html.theme-modern .grid-table tbody tr.row-online,
html.theme-modern .grid-table tbody tr.row-ok,
html.theme-modern .grid-table tbody tr.current-row {
  background: #edf8f0;
}

html.theme-modern .grid-table tbody tr.row-offline,
html.theme-modern .grid-table tbody tr.row-alert {
  background: #fff1f0;
}

html.theme-modern .grid-table tbody tr.payment-import-created,
html.theme-modern .grid-table tbody tr.payment-import-created:nth-child(even) {
  background: #e9f8ec;
}

html.theme-modern .grid-table tbody tr.payment-import-contract-missing,
html.theme-modern .grid-table tbody tr.payment-import-contract-missing:nth-child(even) {
  background: #ffeef2;
}

html.theme-modern .grid-table tbody tr.payment-import-muted,
html.theme-modern .grid-table tbody tr.payment-import-muted:nth-child(even) {
  background: #eeeeee;
}

html.theme-modern .field,
html.theme-modern input.field,
html.theme-modern select.field,
html.theme-modern textarea.field,
html.theme-modern .login-box input {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--console-line-strong);
  border-radius: 5px;
  background: #fff;
}

html.theme-modern input[type="checkbox"].field {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--console-blue);
}

html.theme-modern .edit-layout {
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 10px;
  padding: 0;
}

html.theme-modern .fieldset {
  padding: 12px;
}

html.theme-modern .fieldset h2,
html.theme-modern .section-title {
  color: var(--console-text);
  font-size: 14px;
}

html.theme-modern .menu-grid {
  padding: 0;
  gap: 10px;
}

html.theme-modern .menu-tile {
  min-height: 86px;
  padding: 12px;
}

html.theme-modern .menu-tile:hover {
  border-color: var(--console-blue);
  background: #fbfdff;
}

html.theme-modern .status-pill {
  padding: 3px 7px;
  border-radius: 999px;
}

html.theme-modern .traffic-chart-panel {
  margin: 0 0 12px;
  padding: 12px;
}

html.theme-modern .traffic-chart-wrap {
  border-radius: 6px;
}

html.theme-modern .resource-chart-wrap {
  border-radius: 6px;
}

html.theme-modern .login-box {
  border: 1px solid var(--console-line);
  border-radius: 8px;
  box-shadow: var(--console-shadow);
}

html.theme-modern.portal-shell .portal-page {
  min-height: calc(100vh - 108px);
  padding: 14px 18px 24px;
  background: transparent;
}

html.theme-modern.portal-shell .portal-page > section,
html.theme-modern.portal-shell .portal-page > .grid {
  margin-bottom: 12px;
}

html.theme-modern.portal-shell .portal-actions {
  align-items: flex-start;
}

html.theme-modern.portal-shell .portal-actions .tool {
  width: auto;
}

html.theme-modern.portal-shell .portal-traffic-chart {
  box-shadow: none;
}

@media (max-width: 1100px) {
  html.theme-modern .app-header {
    inset: 0 0 auto 0;
    width: auto;
    height: 56px;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--console-line);
  }

  html.theme-modern .brand-box {
    width: auto;
    flex: 1 0 auto;
  }

  html.theme-modern .theme-toggle {
    margin: 0 0 0 auto;
    white-space: nowrap;
  }

  html.theme-modern .main-menu {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    height: 58px;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--console-surface);
    border-top: 1px solid var(--console-line);
    box-shadow: 0 -1px 4px rgba(16, 24, 40, 0.1);
  }

  html.theme-modern .main-menu a {
    flex: 0 0 auto;
    min-width: 92px;
    min-height: 42px;
    justify-content: center;
    padding: 6px 9px;
    font-size: 12px;
    text-align: center;
  }

  html.theme-modern .tabbar {
    top: 56px;
    height: 50px;
    margin-left: 0;
    margin-top: 56px;
    padding: 0 12px;
  }

  html.theme-modern .tab {
    font-size: 16px;
  }

  html.theme-modern .workspace {
    min-height: calc(100vh - 106px);
    margin-left: 0;
  }

  html.theme-modern .actions {
    top: 106px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 12px;
  }

  html.theme-modern .tool,
  html.theme-modern .small-button {
    flex: 0 0 auto;
    min-height: 34px;
    white-space: nowrap;
  }

  html.theme-modern .content {
    padding: 12px 10px 82px;
  }

  html.theme-modern.portal-shell .portal-page {
    min-height: calc(100vh - 106px);
    padding: 12px 10px 82px;
  }

  html.theme-modern .grid-table {
    display: block;
    width: 100%;
    overflow-x: auto;
  }

  html.theme-modern .grid-table th {
    position: static;
  }

  html.theme-modern .edit-layout,
  html.theme-modern .grid.two {
    grid-template-columns: 1fr;
  }

  html.theme-modern .form-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  html.theme-modern .field-error,
  html.theme-modern .field-help {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  html.theme-modern body {
    font-size: 12px;
  }

  html.theme-modern .brand-box strong {
    font-size: 14px;
  }

  html.theme-modern .theme-toggle {
    min-height: 32px;
    padding: 6px 8px;
  }

  html.theme-modern .summary-line,
  html.theme-modern .filter-panel,
  html.theme-modern .panel,
  html.theme-modern .fieldset {
    border-radius: 5px;
  }
}
