﻿:root {
  --bg: #eef7ff;
  --card: #ffffff;
  --ink: #201c2e;
  --accent: #0b74de;
  --accent-2: #0f8fe8;
  --accent-3: #12b6c9;
  --danger: #b63e2a;
  --border: #c7e0f5;
  --delay-red: #ffe2e2;
  --delay-orange: #ffe9d1;
  --delay-yellow: #fff4c6;
  --delay-green: #e3f6df;
  --delay-green-light: #f0faec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Tajawal", "Cairo", "Segoe UI", Arial, sans-serif;
  font-size: clamp(14px, 0.92vw, 16px);
  line-height: 1.45;
  background:
    radial-gradient(circle at 18% 18%, rgba(11, 116, 222, 0.14), transparent 40%),
    radial-gradient(circle at 84% 10%, rgba(18, 182, 201, 0.12), transparent 36%),
    linear-gradient(180deg, #f7fcff 0%, #e8f4ff 100%);
  color: var(--ink);
}

.app-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}

.app-watermark img {
  width: 100vw;
  height: 100vh;
  opacity: 0.16;
  object-fit: contain;
  filter: saturate(0.85) contrast(1);
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px;
  background: #eef7ff;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.brand-logo {
  width: 340px;
  height: 92px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  padding: 3px 6px;
  box-shadow: 0 4px 12px rgba(57, 43, 97, 0.12);
}

.topbar-main {
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edge-logo {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.edge-left { left: 0; }
.edge-right { right: 0; }

.tabs {
  display: flex;
  gap: 10px;
  padding: 10px 22px 0;
  background: #eef7ff;
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: all 0.18s ease;
}

.tab:hover {
  border-color: #b7d5ef;
  color: var(--accent);
  background: #f1f8ff;
}

.tab:active {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff;
  border-color: var(--accent);
}

.tab.active {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 8px 16px rgba(74, 47, 135, 0.24);
}

.tab.active:hover {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(180deg, #0a81df 0%, var(--accent) 100%);
}

.tabs.single-tab-focus .tab:not(.active) {
  display: none !important;
}

.brand {
  font-family: "Tajawal", "Cairo", "Segoe UI", Arial, sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 1.45vw, 26px);
  letter-spacing: 0.2px;
  color: var(--accent);
  text-align: center;
  max-width: calc(100% - 700px);
  line-height: 1.25;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.lang-switch a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.btn-tabs-toggle {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.btn-subtabs-toggle {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.topbar-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.domain-migration-banner {
  margin: 12px 22px 0;
  padding: 14px 18px;
  border: 1px solid #fdba74;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #9a3412;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 24px rgba(154, 52, 18, 0.12);
}

.domain-migration-banner__title {
  font-weight: 800;
  font-size: 18px;
}

.domain-migration-banner__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.domain-migration-banner__body {
  font-weight: 600;
  line-height: 1.7;
}

.domain-migration-banner__close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #fdba74;
  background: #fff;
  color: #9a3412;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.domain-migration-banner__close:hover {
  background: #ffedd5;
}

.domain-migration-banner__body a {
  color: #b45309;
  text-decoration: none;
  border-bottom: 1px solid rgba(180, 83, 9, 0.3);
}

.container {
  padding: 24px;
  max-width: min(98vw, 1920px);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.app-footer {
  margin: 20px 0 12px;
  padding: 10px 14px;
  text-align: center;
  font-size: clamp(12px, 0.85vw, 14px);
  color: #3a5f84;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 1;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.crumbs .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--accent-2);
  text-decoration: none;
  background: #fff;
  transition: all 0.15s ease;
}

.crumbs a.link:hover {
  border-color: #afd2f0;
  background: #edf6ff;
}

.crumbs a.link:active {
  color: #fff;
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  border-color: var(--accent);
}

.crumbs .sep {
  color: #999;
  align-self: center;
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(51, 39, 87, 0.08);
}

.card.narrow {
  max-width: 520px;
  margin: 0 auto;
}

.login-page {
  min-height: calc(100vh - 230px);
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(216, 205, 239, 0.85);
  backdrop-filter: blur(2px);
}

.card.permissions-card {
  width: min(96vw, 1600px);
  margin: 0 auto;
}

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

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

.perm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #d7c8f2;
  background: #eaf5ff;
  color: #1e5f9f;
  font-size: 11px;
  line-height: 1.3;
}

.perm-chip.chip-risk {
  background: #ffe6e4;
  border-color: #efb3ad;
  color: #9c2e22;
}

.perm-chip.chip-warn {
  background: #fff1df;
  border-color: #ebcda7;
  color: #8a5a18;
}

.perm-chip.chip-good {
  background: #e6f6eb;
  border-color: #b7dfc3;
  color: #256b3d;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  padding: 9px 13px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(13px, 0.9vw, 15px);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: all 0.18s ease;
}

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

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

.btn.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost:hover {
  background: #f3effd;
  border-color: #b7d5ef;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(74, 47, 135, 0.18);
}

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

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

.section-title {
  margin: 0;
  font-family: "Tajawal", "Cairo", "Segoe UI", Arial, sans-serif;
  font-size: clamp(20px, 1.5vw, 28px);
  font-weight: 800;
  letter-spacing: 0.15px;
  line-height: 1.3;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

h1, h2, h3, h4 {
  font-family: "Tajawal", "Cairo", "Segoe UI", Arial, sans-serif;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.15px;
}

.meta {
  color: #666;
  font-size: clamp(12px, 0.86vw, 14px);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--border);
  max-width: 100%;
}

.delay-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: #f7fcff;
}

.delay-filter-bar .btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
  font-size: clamp(12px, 0.76vw, 14px);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.permission-table {
  min-width: 1500px;
}

.permission-table th,
.permission-table td {
  padding: 12px 14px;
  font-size: clamp(13px, 0.85vw, 15px);
}

.permission-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5c3faa;
}

.permission-sections {
  display: grid;
  gap: 14px;
}

.perm-section-card {
  border: 1px solid #d7c8f2;
  border-radius: 12px;
  background: #f7fcff;
  overflow: hidden;
}

.perm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e7dcfb;
  background: linear-gradient(180deg, #e9f5ff 0%, #e1f1ff 100%);
}

.perm-section-header h3 {
  margin: 0;
  font-size: clamp(16px, 1.05vw, 20px);
  color: #1b5a95;
}

.permission-table.permission-table-detailed {
  min-width: 1280px;
}

.table th {
  background: linear-gradient(180deg, #e9f5ff 0%, #d8ecff 100%);
  font-weight: 800;
  white-space: nowrap;
  color: #1a5a93;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table td {
  word-break: break-word;
}

/* Compact construction reports: smaller and single-line rows */
.table.compact-construction {
  min-width: 980px;
}

.table.compact-construction th,
.table.compact-construction td {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow-wrap: normal;
}

.table.compact-construction td {
  word-break: normal;
}

.table.compact-construction th:first-child,
.table.compact-construction td:first-child {
  width: 44px;
}

.table.compact-construction td.actions,
.table.compact-construction td.col-transaction_no,
.table.compact-construction th.col-transaction_no,
.table.compact-construction td.col-rtc_no,
.table.compact-construction th.col-rtc_no {
  white-space: nowrap;
}

.table.compact-cable {
  min-width: 1500px;
}

.table.compact-cable th,
.table.compact-cable td {
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.table.compact-cable th {
  white-space: normal;
  vertical-align: middle;
}

.table.compact-cable td {
  white-space: nowrap;
  word-break: normal;
}

.table.compact-cable td.actions {
  white-space: nowrap;
  min-width: 96px;
}

.table.compact-cable .btn {
  padding: 5px 7px;
  font-size: 11px;
}

.table.compact-faults {
  min-width: 1520px;
}

.table.compact-faults th,
.table.compact-faults td {
  padding: 7px 8px;
  font-size: 11.5px;
  line-height: 1.28;
  text-align: center;
}

.table.compact-faults th {
  white-space: normal;
  vertical-align: middle;
  background: linear-gradient(180deg, #e6f3ff 0%, #d2e8ff 100%);
}

.table.compact-faults td {
  white-space: nowrap;
  word-break: normal;
  vertical-align: middle;
}

.table.compact-faults tbody tr:nth-child(even):not(.delay-red):not(.delay-orange):not(.delay-yellow):not(.delay-green):not(.delay-green-light) td {
  background: #f9fcff;
}

.table.compact-faults th.col-rtc_no,
.table.compact-faults td.col-rtc_no,
.table.compact-faults th.col-fault_no,
.table.compact-faults td.col-fault_no,
.table.compact-faults th.col-notice_no,
.table.compact-faults td.col-notice_no,
.table.compact-faults th.col-booking_no,
.table.compact-faults td.col-booking_no,
.table.compact-faults th.col-work_order,
.table.compact-faults td.col-work_order {
  font-weight: 700;
  color: #164b7a;
  background-clip: padding-box;
}

.table.compact-faults th.col-district,
.table.compact-faults td.col-district,
.table.compact-faults th.col-work_type,
.table.compact-faults td.col-work_type,
.table.compact-faults th.col-status,
.table.compact-faults td.col-status {
  min-width: 120px;
  white-space: normal;
}

.table.compact-faults th.col-invoice_no,
.table.compact-faults td.col-invoice_no,
.table.compact-faults th.col-invoice_date,
.table.compact-faults td.col-invoice_date,
.table.compact-faults th.col-amount,
.table.compact-faults td.col-amount {
  background: #f3f9ff;
}

.table.compact-faults td.actions {
  white-space: nowrap;
  min-width: 120px;
}

.table.compact-faults .btn {
  padding: 5px 7px;
  font-size: 11px;
}

.table tbody tr:hover:not(.delay-red):not(.delay-orange):not(.delay-yellow):not(.delay-green):not(.delay-green-light) td {
  background: #eaf5ff;
}

.table th:first-child,
.table td:first-child {
  text-align: center;
  width: 64px;
  white-space: nowrap;
}

.table tbody tr:nth-child(even):not(.delay-red):not(.delay-orange):not(.delay-yellow):not(.delay-green):not(.delay-green-light) td {
  background: #fcfbff;
}

.table tr.delay-red td { background: var(--delay-red); border-bottom-color: #efb9b9; }
.table tr.delay-orange td { background: var(--delay-orange); border-bottom-color: #ebc8a1; }
.table tr.delay-yellow td { background: var(--delay-yellow); border-bottom-color: #e2cf8a; }
.table tr.delay-green td { background: var(--delay-green); border-bottom-color: #b9dfb1; }
.table tr.delay-green-light td { background: var(--delay-green-light); border-bottom-color: #cfe5c7; }

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.form.grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
}

.form input,
.form select,
.form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: clamp(13px, 0.9vw, 15px);
}

.form textarea {
  min-height: 90px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.flash-list {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7efe4;
  border: 1px solid var(--border);
}

.flash.error {
  background: #fbe7e3;
  border-color: #f0c2b8;
}

.flash.success {
  background: #e7f3e3;
  border-color: #bfe0b4;
}

.flash.device_contact {
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8d9 0%, #ffefb0 100%);
  border: 2px solid #e2c55b;
  color: #5c4300;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(163, 122, 0, 0.18);
}

.workflow-alert-toast {
  position: fixed;
  top: 18px;
  left: 18px;
  transform: none;
  z-index: 1200;
  width: min(92vw, 520px);
  min-height: 132px;
  padding: 24px 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff7d0 0%, #fff1b3 100%);
  border: 3px solid #f2b705;
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.28);
  text-align: center;
  animation: workflow-alert-pulse 1.15s ease-in-out infinite;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.workflow-alert-toast__close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(138, 75, 0, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: #8a4b00;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.workflow-alert-toast__close:hover {
  transform: scale(1.05);
  background: #fff;
  border-color: rgba(138, 75, 0, 0.35);
}

.workflow-alert-toast.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(0.96);
  pointer-events: none;
}

.workflow-alert-toast__title {
  font-weight: 800;
  font-size: 2rem;
  color: #8a4b00;
}

.workflow-alert-toast__body {
  color: #5c3b02;
  font-size: 1.1rem;
  line-height: 1.9;
}

.workflow-alert-toast__link {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  color: #0f5bd8;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 10px 18px;
  align-self: center;
}

@keyframes workflow-alert-pulse {
  0%,
  100% {
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.18);
    border-color: #f2b705;
  }
  50% {
    box-shadow: 0 22px 56px rgba(242, 183, 5, 0.34);
    border-color: #ff8c00;
  }
}

.hint {
  margin-top: 12px;
  font-size: 13px;
  color: #666;
}

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

.dashboard-kpis .stat-card {
  border-color: #b7d8f3;
  background: linear-gradient(180deg, #ffffff 0%, #eef8ff 100%);
  box-shadow: 0 6px 16px rgba(74, 47, 135, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-kpis .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 116, 222, 0.14);
}

.dashboard-kpis .stat-card strong {
  font-size: clamp(20px, 1.7vw, 28px);
}

.stat-card-accent {
  background: linear-gradient(135deg, #0b74de 0%, #11a0df 45%, #17b6c8 100%) !important;
  border-color: #0f8fe8 !important;
  color: #fff;
  box-shadow: 0 12px 28px rgba(96, 75, 167, 0.28) !important;
}

.stat-card-accent strong {
  color: #fff;
  text-shadow: 0 1px 0 rgba(34, 20, 72, 0.35);
}

.dashboard-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
  gap: 14px;
}

.dashboard-hero {
  background:
    radial-gradient(circle at 8% 15%, rgba(106, 74, 168, 0.16), transparent 35%),
    radial-gradient(circle at 92% 8%, rgba(74, 47, 135, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #e9f5ff 100%);
}

.dashboard-page .section-title {
  letter-spacing: 0;
}

.dashboard-page .table th {
  background: linear-gradient(180deg, #e3f2ff 0%, #d3eaff 100%);
  color: #124f87;
}

.dashboard-page .table td {
  font-size: clamp(12px, 0.78vw, 14px);
}

.dashboard-section-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f7fcff 100%);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(66, 46, 110, 0.08);
}

.dashboard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: linear-gradient(180deg, #e9f5ff 0%, #ddf0ff 100%);
  border-bottom: 1px solid var(--border);
}

.dashboard-section-head h4 {
  margin: 0;
  font-size: clamp(16px, 1.1vw, 20px);
}

.dashboard-tabs-table {
  min-width: 760px;
}

.safety-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.safety-chart-card {
  padding: 12px;
}

.safety-chart-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.safety-bar-line {
  height: 12px;
  width: 100%;
  background: #e7f4ff;
  border: 1px solid #d6caef;
  border-radius: 999px;
  overflow: hidden;
}

.safety-bar {
  height: 100%;
  border-radius: 999px;
}

.safety-bar-used {
  background: linear-gradient(90deg, #e66a5d 0%, #cf4031 100%);
}

.safety-bar-available {
  background: linear-gradient(90deg, #75bc76 0%, #3b9c56 100%);
}

.stat-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.stat-card strong {
  display: block;
  font-size: clamp(18px, 1.45vw, 24px);
  margin-top: 6px;
  color: var(--accent);
}

.action-menu {
  position: relative;
  width: 100%;
  min-width: 150px;
  z-index: 5;
  isolation: isolate;
}

.action-menu summary {
  list-style: none;
  cursor: pointer;
}

.action-menu__summary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: clamp(15px, 1vw, 18px);
  font-weight: 800;
  min-height: 48px;
  padding-inline: 14px;
  background: #edf6ff;
  border-color: #9dc5eb;
  color: #154d7f;
  box-shadow: 0 4px 12px rgba(11, 116, 222, 0.12);
}

.action-menu__chevron {
  font-size: 18px;
  line-height: 1;
  color: #0f6fa8;
  transition: transform 0.18s ease;
}

.action-menu__list {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  z-index: 200;
  min-width: 260px;
  width: max-content;
  max-width: 340px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid #b8d5ef;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 40px rgba(15, 35, 95, 0.24);
  opacity: 1;
}

.table td.actions .action-menu > .action-menu__list {
  display: none !important;
}

.action-menu__source {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.34);
}

.action-menu.is-open .action-menu__source {
  display: flex;
}

.action-popup-open {
  overflow: hidden;
}

.action-popup-panel {
  width: min(92vw, 430px);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid #b8d5ef;
  background: #ffffff;
  box-shadow: 0 24px 54px rgba(15, 35, 95, 0.3);
  overflow: hidden;
}

.action-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: #edf6ff;
  border-bottom: 1px solid #d5e6f6;
  color: #154d7f;
}

.action-popup-head strong {
  font-size: clamp(18px, 1.1vw, 22px);
}

.action-popup-close {
  width: 42px;
  height: 42px;
  border: 1px solid #c4d8ec;
  border-radius: 999px;
  background: #ffffff;
  color: #154d7f;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.action-popup-body {
  padding: 18px;
  overflow: auto;
  background: #ffffff;
}

.action-popup-body .action-menu__list {
  position: static;
  inset: auto;
  top: auto;
  min-width: 100%;
  max-width: 100%;
  max-height: none;
  width: 100%;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #ffffff;
  opacity: 1 !important;
  visibility: visible !important;
  overflow: visible !important;
}

.action-menu__list form {
  margin: 0;
}

.action-menu__list .btn,
.action-menu__list form .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: start;
  min-height: 48px;
  padding: 12px 14px;
  font-size: clamp(15px, 1vw, 17px);
  font-weight: 700;
  white-space: normal;
  line-height: 1.55;
  border-radius: 12px;
  background: #eef6ff;
  border: 1px solid #c1d9ef;
  color: #153f67;
  box-shadow: 0 3px 8px rgba(10, 58, 106, 0.08);
}

.action-menu__list .btn.ghost,
.action-menu__list form .btn.ghost {
  background: #eef6ff;
  border-color: #c1d9ef;
  color: #153f67;
}

.action-menu__list .btn.ghost:hover,
.action-menu__list form .btn.ghost:hover {
  background: #e1f0ff;
  border-color: #98c1e7;
}

.action-menu__list .btn.success,
.action-menu__list form .btn.success {
  background: #dff5e6;
  border-color: #a8d8b5;
  color: #1f6a34;
}

.action-menu__list .btn.primary,
.action-menu__list form .btn.primary {
  background: #dbeeff;
  border-color: #94bfe8;
  color: #0f4f8e;
}

.action-menu__list .btn.warning,
.action-menu__list form .btn.warning {
  background: #ffe9bf;
  border-color: #efcf8d;
  color: #8a5b08;
}

.action-menu__list .action-item-view {
  background: #dbeeff !important;
  border-color: #9dc6ea !important;
  color: #0f4f8e !important;
}

.action-menu__list .action-item-view:hover {
  background: #cfe7ff !important;
  border-color: #7fb2df !important;
}

.action-menu__list .action-item-success,
.action-menu__list .btn.success,
.action-menu__list form .btn.success {
  background: #dff5e6;
  border-color: #a8d8b5;
  color: #1f6a34;
}

.action-menu__item-muted {
  background: #edf2f7 !important;
  border-color: #d6dee8 !important;
  color: #5a6b7d !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

.action-menu__status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
  border: 1px solid #d3dfec;
  color: #1c3556;
  text-align: start;
}

.action-menu__status strong {
  font-size: clamp(15px, 1vw, 17px);
}

.action-menu__status small {
  color: #5a6f8a;
  font-size: clamp(13px, 0.88vw, 14px);
}

.table td.actions {
  position: relative;
  min-width: 170px;
  overflow: visible;
}

.transaction-editor-card {
  padding: 20px;
}

.transaction-editor-card .section-title {
  font-size: clamp(24px, 1.8vw, 32px);
  margin-bottom: 6px;
}

.transaction-editor-card .meta {
  font-size: clamp(14px, 1vw, 17px);
  line-height: 1.7;
}

.transaction-editor-form {
  gap: 14px 16px;
}

.transaction-editor-form label {
  font-size: clamp(15px, 1vw, 18px);
  font-weight: 800;
  color: #1f4d7a;
  align-self: center;
}

.transaction-editor-form input,
.transaction-editor-form select,
.transaction-editor-form textarea {
  min-height: 48px;
  padding: 12px 14px;
  font-size: clamp(15px, 1.02vw, 18px);
  font-weight: 600;
}

.transaction-editor-form textarea {
  min-height: 120px;
}

.transaction-editor-card .form-actions .btn {
  min-height: 46px;
  font-size: clamp(14px, 0.98vw, 17px);
  font-weight: 800;
}

@media (max-width: 900px) {
  .topbar {
    padding: 12px 12px 10px;
  }
  .topbar-main {
    min-height: 0;
    flex-direction: column;
    gap: 8px;
  }
  .edge-logo {
    position: static;
    transform: none;
  }
  .edge-left,
  .edge-right {
    left: auto;
    right: auto;
  }
  .brand-logo {
    width: min(82vw, 330px);
    height: 60px;
  }
  .form.grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand {
    font-size: 15px;
    max-width: 100%;
    text-align: center;
  }
  .tabs {
    padding: 8px 10px 0;
    gap: 8px;
  }
  .tab {
    padding: 8px 11px;
    font-size: 13px;
  }
  .table th,
  .table td {
    padding: 8px 9px;
    font-size: 12px;
  }
  .table { min-width: 900px; }
  .topbar-sub {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .btn {
    min-height: 40px;
  }
  .dashboard-sections-grid {
    grid-template-columns: 1fr;
  }
  .action-menu__list {
    min-width: 220px;
    max-width: 280px;
  }
  .transaction-editor-form label {
    align-self: stretch;
  }
}

@media (max-width: 1400px) {
  .container {
    padding: 18px;
    max-width: 100vw;
  }
  .table {
    min-width: 1000px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 10px;
  }
  .card {
    padding: 10px;
  }
  .table { min-width: 640px; }
  .table th,
  .table td {
    padding: 6px 7px;
    font-size: 11px;
  }
  .section-title {
    font-size: 18px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .tab {
    padding: 7px 10px;
    font-size: 12px;
  }
  .brand-logo {
    width: min(88vw, 320px);
    height: 54px;
  }
  .app-footer {
    font-size: 11px;
    line-height: 1.5;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  .topbar,
  .tabs,
  .crumbs,
  .actions,
  .form-actions,
  .app-footer,
  .delay-filter-bar {
    display: none !important;
  }
  .container {
    max-width: 100%;
    padding: 0;
  }
  .card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .table-wrap {
    border: none;
    overflow: visible;
  }
  .table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .table th,
  .table td {
    font-size: 10px;
    padding: 6px 7px;
    white-space: normal;
    word-break: break-word;
  }
  .table th:empty,
  .table td.actions {
    display: none;
  }
}

