:root {
  --bg: #f4f1e8;
  --bg-strong: #e7ddc8;
  --surface: #fffdf7;
  --surface-muted: #f6efe1;
  --text: #1f2a23;
  --text-muted: #647166;
  --border: #d3c7b1;
  --primary: #265d4a;
  --primary-strong: #173f31;
  --danger: #a6463c;
  --danger-strong: #7f3129;
  --warning: #d0a646;
  --field-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 239, 225, 0.9));
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 18px rgba(51, 45, 30, 0.04);
  --focus-ring: rgba(38, 93, 74, 0.16);
  --shadow: 0 18px 40px rgba(51, 45, 30, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --font-main: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(38, 93, 74, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(208, 166, 70, 0.18), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-main);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.top-utility-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-toggle {
  display: none;
}

.language-switcher,
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.language-link,
.nav-link,
.tab,
.secondary-button,
.primary-button,
.danger-button {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-link,
.tab {
  padding: 10px 14px;
  border-radius: 999px;
}

.nav-link {
  color: var(--text-muted);
}

.nav-link.active,
.tab.active {
  background: var(--primary);
  color: #fff;
}

.language-switcher {
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(211, 199, 177, 0.7);
  border-radius: 999px;
  background: rgba(246, 239, 225, 0.85);
}

.language-link {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1;
}

.language-link.active {
  background: var(--primary);
  color: #fff;
}

.nav-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-shell {
  padding-top: 28px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-header h1,
.section-heading h1,
.section-heading h2,
.panel h2 {
  margin: 0 0 8px;
}

.panel,
.auth-card,
.stat-card {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.panel,
.auth-card {
  padding: 24px;
}

.auth-card {
  width: min(480px, 100%);
  margin: 72px auto 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
}

.stat-card-button {
  width: 100%;
  color: inherit;
  text-align: start;
  font: inherit;
  cursor: pointer;
  appearance: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.stat-card-button:hover {
  transform: translateY(-2px);
  border-color: rgba(38, 93, 74, 0.35);
}

.stat-card-button:focus-visible {
  outline: 2px solid rgba(38, 93, 74, 0.28);
  outline-offset: 3px;
}

.stat-card.selected {
  border-color: rgba(38, 93, 74, 0.5);
  transform: translateY(-2px);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.stat-value {
  font-size: 2rem;
}

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

.tab-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-nav {
  margin-bottom: 22px;
}

.settings-grid {
  margin-bottom: 0;
}

.settings-card {
  justify-content: space-between;
  min-height: 170px;
  color: inherit;
}

.settings-card:hover {
  border-color: rgba(38, 93, 74, 0.5);
  transform: translateY(-2px);
}

.settings-card-copy {
  display: grid;
  gap: 8px;
}

.settings-card-title {
  font-size: 1.12rem;
}

.tab {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.search-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.search-form > .primary-button,
.search-form > .secondary-button,
.search-form > .danger-button,
.search-form > button {
  align-self: flex-end;
}

.search-form input,
.search-form select,
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-surface);
  color: var(--text);
  box-shadow: var(--field-shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.search-form input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: rgba(100, 113, 102, 0.85);
}

.search-form input:focus,
.search-form select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(38, 93, 74, 0.58);
  box-shadow: var(--field-shadow), 0 0 0 4px var(--focus-ring);
}

.search-form select,
.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-inline-end: 46px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 5.25 7 9l4-3.75' stroke='%23647166' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    var(--field-surface);
  background-repeat: no-repeat, no-repeat;
  background-position: right 14px center, 0 0;
  background-size: 14px 14px, 100% 100%;
}

.search-form input[type="date"],
.search-form input[type="month"],
.field input[type="date"],
.field input[type="month"] {
  cursor: pointer;
  padding-inline-end: 50px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Crect x='2.25' y='3.25' width='13.5' height='12' rx='2.25' stroke='%23647166' stroke-width='1.5'/%3E%3Cpath d='M5.5 1.75v3M12.5 1.75v3M2.25 6.5h13.5' stroke='%23647166' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"),
    var(--field-surface);
  background-repeat: no-repeat, no-repeat;
  background-position: right 13px center, 0 0;
  background-size: 18px 18px, 100% 100%;
  color-scheme: light;
}

.search-form input[type="date"]::-webkit-calendar-picker-indicator,
.search-form input[type="month"]::-webkit-calendar-picker-indicator,
.field input[type="date"]::-webkit-calendar-picker-indicator,
.field input[type="month"]::-webkit-calendar-picker-indicator {
  width: 22px;
  height: 22px;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.search-form input[type="date"]::-webkit-datetime-edit,
.search-form input[type="month"]::-webkit-datetime-edit,
.field input[type="date"]::-webkit-datetime-edit,
.field input[type="month"]::-webkit-datetime-edit {
  color: var(--text);
}

.search-form input[type="date"]::-webkit-datetime-edit-text,
.search-form input[type="month"]::-webkit-datetime-edit-text,
.field input[type="date"]::-webkit-datetime-edit-text,
.field input[type="month"]::-webkit-datetime-edit-text {
  color: var(--text-muted);
  padding-inline: 4px;
}

.search-form select option,
.field select option {
  background: var(--surface);
  color: var(--text);
}

.search-form select option:checked,
.field select option:checked {
  background: var(--primary);
  color: #fff;
}

.search-form input:disabled,
.search-form select:disabled,
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  box-shadow: none;
}

.search-form input {
  width: min(280px, 100%);
}

[dir="rtl"] .search-form select,
[dir="rtl"] .field select {
  background-position: left 14px center, 0 0;
}

[dir="rtl"] .search-form input[type="date"],
[dir="rtl"] .search-form input[type="month"],
[dir="rtl"] .field input[type="date"],
[dir="rtl"] .field input[type="month"] {
  background-position: left 13px center, 0 0;
}

.picker-shell {
  position: relative;
  width: 100%;
}

.field .picker-shell {
  width: 100%;
}

.search-form .picker-shell {
  width: min(220px, 100%);
  flex: 1 1 180px;
}

.picker-shell.is-open {
  z-index: 90;
}

.picker-native {
  display: none !important;
}

.picker-trigger {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-surface);
  color: var(--text);
  box-shadow: var(--field-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  text-align: start;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.picker-trigger:hover {
  border-color: rgba(38, 93, 74, 0.4);
}

.picker-trigger:focus-visible,
.picker-shell.is-open .picker-trigger {
  outline: none;
  border-color: rgba(38, 93, 74, 0.58);
  box-shadow: var(--field-shadow), 0 0 0 4px var(--focus-ring);
}

.picker-shell.is-disabled .picker-trigger,
.picker-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  box-shadow: none;
}

.picker-trigger-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-trigger-value.is-placeholder {
  color: var(--text-muted);
}

.picker-trigger-icon {
  flex: none;
  width: 18px;
  height: 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
  transition: transform 160ms ease, opacity 160ms ease;
}

.picker-trigger-icon-chevron {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 5.25 7 9l4-3.75' stroke='%23647166' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.picker-trigger-icon-calendar {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Crect x='2.25' y='3.25' width='13.5' height='12' rx='2.25' stroke='%23647166' stroke-width='1.5'/%3E%3Cpath d='M5.5 1.75v3M12.5 1.75v3M2.25 6.5h13.5' stroke='%23647166' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.picker-shell.is-open .picker-trigger-icon-chevron {
  transform: rotate(180deg);
}

.picker-popover {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-start: 0;
  width: min(320px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid rgba(211, 199, 177, 0.9);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(246, 239, 225, 0.96));
  box-shadow: 0 22px 40px rgba(51, 45, 30, 0.16);
  backdrop-filter: blur(8px);
}

.picker-popover[hidden] {
  display: none;
}

.custom-select .picker-popover {
  width: 100%;
  min-width: 100%;
  padding: 10px;
}

.picker-search-field {
  display: block;
  margin-bottom: 10px;
}

.picker-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-surface);
  color: var(--text);
  box-shadow: var(--field-shadow);
}

.picker-search-input:focus {
  outline: none;
  border-color: rgba(38, 93, 74, 0.58);
  box-shadow: var(--field-shadow), 0 0 0 4px var(--focus-ring);
}

.picker-search-input::placeholder {
  color: rgba(100, 113, 102, 0.85);
}

.picker-options {
  display: grid;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
}

.picker-option {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: start;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.picker-option:hover,
.picker-option:focus-visible {
  outline: none;
  background: rgba(38, 93, 74, 0.08);
  border-color: rgba(38, 93, 74, 0.18);
}

.picker-option.is-selected {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 18px rgba(38, 93, 74, 0.2);
}

.picker-option.is-placeholder:not(.is-selected) {
  color: var(--text-muted);
}

.picker-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.picker-calendar-popover {
  width: min(320px, calc(100vw - 32px));
}

.picker-calendar-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.picker-calendar-title {
  text-align: center;
  font-weight: 700;
}

.picker-nav-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(211, 199, 177, 0.8);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.92);
  color: var(--text-muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.picker-nav-button:hover,
.picker-nav-button:focus-visible {
  outline: none;
  background: rgba(38, 93, 74, 0.08);
  border-color: rgba(38, 93, 74, 0.22);
  color: var(--primary);
}

.picker-nav-icon {
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-inline-end: 2px solid currentColor;
  display: inline-block;
}

.picker-nav-icon-previous {
  transform: rotate(-135deg);
}

.picker-nav-icon-next {
  transform: rotate(45deg);
}

[dir="rtl"] .picker-nav-icon-previous {
  transform: rotate(45deg);
}

[dir="rtl"] .picker-nav-icon-next {
  transform: rotate(-135deg);
}

.picker-calendar-weekdays,
.picker-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.picker-calendar-weekdays {
  margin-bottom: 8px;
}

.picker-calendar-weekdays span {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.picker-calendar-cell,
.picker-month-cell {
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.picker-calendar-cell:hover,
.picker-calendar-cell:focus-visible,
.picker-month-cell:hover,
.picker-month-cell:focus-visible {
  outline: none;
  background: rgba(38, 93, 74, 0.08);
  border-color: rgba(38, 93, 74, 0.18);
}

.picker-calendar-cell.is-muted {
  color: rgba(100, 113, 102, 0.55);
}

.picker-calendar-cell.is-selected,
.picker-month-cell.is-selected {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 18px rgba(38, 93, 74, 0.2);
}

.picker-calendar-cell.is-today:not(.is-selected),
.picker-month-cell.is-today:not(.is-selected) {
  background: rgba(38, 93, 74, 0.08);
  border-color: rgba(38, 93, 74, 0.28);
}

.picker-month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.picker-month-cell {
  min-height: 46px;
  padding: 10px 8px;
}

.picker-calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(211, 199, 177, 0.6);
}

.picker-action {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.picker-action:hover,
.picker-action:focus-visible {
  outline: none;
  background: rgba(38, 93, 74, 0.08);
}

.picker-action.is-secondary {
  color: var(--text-muted);
}

[dir="rtl"] .picker-popover {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px 12px;
  border-bottom: 1px solid rgba(211, 199, 177, 0.55);
  text-align: start;
  vertical-align: top;
}

.data-table tr.is-selected td {
  background: rgba(38, 93, 74, 0.07);
}

.row-link {
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  line-height: 1.1;
  white-space: nowrap;
}

.badge-active {
  background: rgba(38, 93, 74, 0.12);
  color: var(--primary-strong);
}

.badge-inactive {
  background: rgba(166, 70, 60, 0.12);
  color: var(--danger-strong);
}

.badge-warning {
  background: rgba(208, 166, 70, 0.18);
  color: #7d5d16;
}

.badge-muted {
  background: rgba(100, 113, 102, 0.12);
  color: var(--text-muted);
}

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

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

.stacked-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

[hidden] {
  display: none !important;
}

.section-subpanel {
  padding: 18px;
  border-radius: 16px;
  background: rgba(246, 239, 225, 0.52);
  box-shadow: none;
}

.billing-config-grid,
.billing-preview-grid {
  display: grid;
  gap: 14px;
}

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

.billing-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.billing-preview-panel {
  gap: 16px;
}

.billing-config-panel {
  display: grid;
  gap: 10px;
}

.electricity-price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.electricity-price-card {
  display: grid;
  gap: 18px;
}

.price-history-section {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

.price-history-section h3 {
  margin: 0;
}

.currency-field {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-surface);
  box-shadow: var(--field-shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.currency-field:focus-within {
  border-color: rgba(38, 93, 74, 0.58);
  box-shadow: var(--field-shadow), 0 0 0 4px var(--focus-ring);
}

.currency-prefix {
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1;
}

.currency-field input {
  width: 100%;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.currency-field input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

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

.password-input {
  position: relative;
}

.password-input input {
  padding-inline-end: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 8px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 160ms ease, color 160ms ease;
}

.password-toggle:hover {
  background: rgba(38, 93, 74, 0.08);
  color: var(--primary);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(38, 93, 74, 0.38);
  outline-offset: 2px;
}

.password-toggle-eye {
  position: relative;
  width: 18px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 999px / 75%;
}

.password-toggle-eye::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.password-toggle-slash {
  position: absolute;
  width: 2px;
  height: 18px;
  background: currentColor;
  border-radius: 999px;
  transform: rotate(40deg);
  transition: opacity 160ms ease;
}

.password-toggle[aria-pressed="true"] {
  color: var(--primary);
}

.password-toggle[aria-pressed="true"] .password-toggle-slash {
  opacity: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 20px;
}

.subscriber-overview-panel {
  display: grid;
  gap: 20px;
}

.subscriber-overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.subscriber-hero {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.subscriber-hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.subscriber-hero-title h2 {
  margin: 0;
}

.subscriber-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subscriber-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(211, 199, 177, 0.6);
  border-radius: 999px;
  background: rgba(246, 239, 225, 0.56);
  color: var(--text-muted);
}

.section-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(246, 239, 225, 0.88);
  color: var(--text);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.section-link:hover {
  background: var(--bg-strong);
  border-color: rgba(38, 93, 74, 0.25);
}

.section-link.active {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.section-link.active:hover {
  background: var(--primary-strong);
  border-color: transparent;
}

.subscriber-overview-grid {
  margin-bottom: 0;
}

.subscriber-overview-grid + .subscriber-overview-grid {
  margin-top: 16px;
}

.subscriber-overview-grid-primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subscriber-overview-grid-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subscriber-record-grid {
  align-items: start;
}

.subscriber-record-grid:not(.has-visible-main-panel) {
  grid-template-columns: 1fr;
}

.subscriber-main-stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.subscriber-stat-value {
  font-size: 1.45rem;
}

.subscriber-overview-details {
  display: grid;
  gap: 16px;
}

.subscriber-overview-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 199, 177, 0.55);
  border-radius: 14px;
  background: rgba(246, 239, 225, 0.52);
}

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

.sidebar-panel {
  display: grid;
  gap: 20px;
  align-content: start;
}

.sidebar-section + .sidebar-section {
  padding-top: 20px;
  border-top: 1px solid rgba(211, 199, 177, 0.55);
}

.mini-table {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.mini-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 199, 177, 0.55);
  border-radius: 14px;
  background: rgba(246, 239, 225, 0.52);
}

.meta-list {
  display: grid;
  gap: 16px;
  margin: 0;
}

.meta-list div {
  display: grid;
  gap: 4px;
}

.meta-list dt {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.meta-list dd {
  margin: 0;
  font-weight: 700;
}

.alerts,
.inline-errors {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.toast-stack {
  position: fixed;
  top: 22px;
  inset-inline-end: 22px;
  z-index: 1200;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 42, 35, 0.42);
  backdrop-filter: blur(4px);
}

.confirm-modal {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(246, 239, 225, 0.96));
  box-shadow: 0 28px 60px rgba(31, 42, 35, 0.26);
  display: grid;
  gap: 16px;
}

.confirm-modal h2 {
  margin: 0;
}

.confirm-modal-message {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

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

.payment-details-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(246, 239, 225, 0.96));
  box-shadow: 0 28px 60px rgba(31, 42, 35, 0.26);
  display: grid;
  gap: 18px;
}

.payment-details-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.payment-details-modal-header h2 {
  margin: 0;
}

.payment-details-modal-body {
  overflow: auto;
  padding-inline-end: 4px;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.toast-message {
  box-shadow: var(--shadow);
  background: rgba(255, 253, 247, 0.96);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-10px);
  animation: toast-in 180ms ease forwards;
}

.toast-message.is-hiding {
  animation: toast-out 220ms ease forwards;
}

.alert.success {
  background: rgba(38, 93, 74, 0.12);
  border-color: rgba(38, 93, 74, 0.22);
}

.alert.error {
  background: rgba(166, 70, 60, 0.1);
  border-color: rgba(166, 70, 60, 0.22);
}

.alert.warning {
  background: rgba(208, 166, 70, 0.14);
  border-color: rgba(208, 166, 70, 0.26);
}

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

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

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.danger-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(211, 199, 177, 0.55);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.secondary-button:hover {
  background: var(--bg-strong);
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.danger-button:hover {
  background: var(--danger-strong);
}

.compact-button {
  min-height: 38px;
  padding: 10px 14px;
}

.monthly-history-table th,
.monthly-history-table td {
  vertical-align: middle;
}

.monthly-history-table td:first-child {
  vertical-align: top;
}

.table-empty-value {
  color: var(--text-muted);
}

.history-payment-list {
  display: grid;
  gap: 8px;
}

.history-payment-item {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(211, 199, 177, 0.5);
  border-radius: 12px;
  background: rgba(246, 239, 225, 0.45);
}

.history-payment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.payment-list-table th,
.payment-list-table td {
  vertical-align: middle;
}

.payment-records-table .payment-record-summary {
  cursor: pointer;
}

.payment-records-table .payment-record-summary td {
  vertical-align: middle;
}

.payment-records-table .payment-record-summary:hover td {
  background: rgba(38, 93, 74, 0.05);
}

.payment-records-table .payment-record-summary.is-open td {
  background: rgba(38, 93, 74, 0.07);
}

.payment-records-table .payment-record-summary:focus-visible {
  outline: 2px solid rgba(38, 93, 74, 0.38);
  outline-offset: 2px;
}

.payment-record-primary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-record-details-row td {
  background: rgba(255, 253, 247, 0.92);
}

.payment-record-details-cell {
  padding-top: 0 !important;
  border-bottom: 1px solid rgba(211, 199, 177, 0.55);
}

.payment-record-details {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(211, 199, 177, 0.55);
  border-radius: 16px;
  background: rgba(246, 239, 225, 0.45);
}

.payment-record-details-panel {
  display: grid;
  gap: 14px;
}

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

.payment-record-notes {
  display: grid;
  gap: 6px;
}

.payment-record-notes p {
  margin: 0;
}

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

.payment-record-actions form {
  margin: 0;
}

.payment-record-delete-panel {
  display: grid;
  justify-items: center;
  padding: 8px 0;
}

.payment-record-delete-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(211, 199, 177, 0.55);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.92);
}

.payment-record-delete-card h3,
.payment-record-delete-card p {
  margin: 0;
}

.payment-list-table td:first-child {
  vertical-align: top;
}

.payment-filter-form {
  row-gap: 12px;
}

.payment-status-badge {
  min-height: 32px;
  padding: 6px 12px;
}

.payment-row-actions {
  align-items: center;
  gap: 8px;
}

.payment-row-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 0.9rem;
  line-height: 1.1;
  white-space: nowrap;
}

.full-width {
  width: 100%;
}

.empty-state,
.simple-panel {
  text-align: center;
}

.simple-panel {
  width: min(560px, 100%);
  margin: 56px auto 0;
}

.logout-form {
  margin-top: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.phone-field-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
}

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

.top-space {
  margin-top: 20px;
}

.panel-highlight {
  border-color: rgba(38, 93, 74, 0.35);
}

[dir="rtl"] .topbar,
[dir="rtl"] .top-utility-bar,
[dir="rtl"] .section-header,
[dir="rtl"] .toolbar,
[dir="rtl"] .brand-block,
[dir="rtl"] .topbar-actions,
[dir="rtl"] .main-nav,
[dir="rtl"] .search-form,
[dir="rtl"] .section-links,
[dir="rtl"] .tab-group,
[dir="rtl"] .row-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .section-header > div:first-child {
  margin-inline-end: auto;
  text-align: right;
}

[dir="rtl"] .confirm-modal-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .payment-details-modal-header {
  flex-direction: row-reverse;
}

@media (max-width: 900px) {
  .content-grid,
  .electricity-price-grid,
  .stats-grid,
  .expenses-grid,
  .phone-field-grid,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .subscriber-overview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .section-links {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 100%);
  }

  .panel,
  .auth-card {
    padding: 20px;
  }

  .topbar,
  .section-header,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    gap: 10px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(246, 239, 225, 0.9);
    color: var(--text);
    cursor: pointer;
  }

  .nav-toggle-icon {
    display: inline-grid;
    gap: 4px;
  }

  .nav-toggle-icon span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 4px;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav .nav-link {
    width: 100%;
    text-align: center;
  }

  .top-utility-bar {
    margin-bottom: 8px;
  }

  .language-switcher {
    margin-inline-start: auto;
  }

  .section-header,
  .toolbar,
  .row-actions,
  .search-form,
  .tab-group,
  .section-links {
    width: 100%;
  }

  .row-actions,
  .search-form,
  .tab-group,
  .section-links {
    display: grid;
    gap: 10px;
  }

  .section-header .row-actions > *,
  .toolbar .tab-group > *,
  .toolbar .search-form > * {
    width: 100%;
  }

  .search-form input {
    width: 100%;
  }

  .section-links .section-link {
    width: 100%;
  }

  .subscriber-meta-row {
    width: 100%;
    display: grid;
  }

  .subscriber-overview-grid-primary,
  .subscriber-overview-grid-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 18px;
  }

  .stat-value {
    font-size: 1.65rem;
  }

  .table-shell {
    overflow: visible;
  }

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

  .data-table thead {
    display: none;
  }

  .data-table tr {
    padding: 14px 16px;
    border: 1px solid rgba(211, 199, 177, 0.55);
    border-radius: 18px;
    background: rgba(255, 253, 247, 0.92);
    box-shadow: 0 10px 24px rgba(51, 45, 30, 0.06);
  }

  .data-table tr.is-selected {
    border-color: rgba(38, 93, 74, 0.42);
    box-shadow: 0 14px 28px rgba(38, 93, 74, 0.12);
  }

  .data-table tr + tr {
    margin-top: 14px;
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(211, 199, 177, 0.4);
    align-items: start;
  }

  .data-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
  }

  .data-table td .row-actions {
    grid-template-columns: 1fr;
  }

  .data-table td .row-actions form,
  .data-table td .row-actions a,
  .data-table td .row-actions button,
  .data-table td > form,
  .data-table td > a {
    width: 100%;
  }

  .data-table td .badge {
    justify-self: start;
  }

  .history-payment-item {
    gap: 8px;
  }

  .history-payment-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .payment-records-table .payment-record-details-row td::before {
    content: none;
  }

  .payment-records-table .payment-record-details-row {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    border-radius: 0 0 18px 18px;
  }

  .payment-records-table .payment-record-summary.is-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .payment-record-primary {
    align-items: flex-start;
  }

  .simple-panel,
  .auth-card {
    margin-top: 40px;
  }

  .toast-stack {
    top: 14px;
    inset-inline: 14px;
    width: auto;
  }

  .confirm-modal-actions > button {
    flex: 1 1 180px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: calc(100% - 16px);
  }

  .panel,
  .auth-card {
    padding: 18px;
  }

  .topbar {
    padding: 16px 18px;
    border-radius: 22px;
  }

  .brand {
    font-size: 1.08rem;
  }

  .language-link {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .data-table tr {
    padding: 12px 14px;
    border-radius: 16px;
  }

  .data-table td {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .data-table td::before {
    font-size: 0.82rem;
  }

  .subscriber-overview-grid-primary,
  .subscriber-overview-grid-secondary {
    grid-template-columns: 1fr;
  }

  .payment-record-details {
    padding: 16px;
  }

  .confirm-modal-backdrop {
    padding: 16px;
  }

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

  .payment-details-modal {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .payment-details-modal-header {
    display: grid;
  }

  .confirm-modal-actions {
    display: grid;
  }
}
