/* ==================================================================
   ICARUZEN DASHBOARD — CSS (scoped to #iz-app)
   ================================================================== */

/* WP admin uses .wrap with padding; we use full-width inside */
.iz-wrap { margin: 0 -20px 0 0; padding: 0; max-width: none; }
@media (max-width: 782px) {
  .iz-wrap { margin: 0 -10px 0 -10px; }
}

#iz-app {
  /* Brand colors */
  --iz-navy-darkest: #060d1f;
  --iz-navy-dark: #0a1733;
  --iz-navy: #142850;
  --iz-navy-medium: #1e3a5f;
  --iz-navy-light: #2d4f7f;

  --iz-gold-dark: #a08442;
  --iz-gold: #c9a55c;
  --iz-gold-light: #e8c77f;
  --iz-gold-pale: #f5e6c3;
  --iz-cream: #fdf8f0;

  --iz-success: #4a7c59;
  --iz-success-bg: #d4e8da;
  --iz-warning: #d4a574;
  --iz-warning-bg: #fef0d9;
  --iz-danger: #b23a48;
  --iz-danger-bg: #f4d8dc;
  --iz-info: #4a6f8a;
  --iz-info-bg: #d4e2ec;

  --iz-bg: #f8f5ee;
  --iz-surface: #ffffff;
  --iz-border: #e5dcc8;
  --iz-border-soft: #f0e8d6;
  --iz-text: #1a1a2e;
  --iz-text-soft: #5a5a6e;
  --iz-text-muted: #8a8a99;

  background: var(--iz-bg);
  color: var(--iz-text);
  font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  direction: rtl;
  padding-bottom: 60px;
}

#iz-app * { box-sizing: border-box; font-family: inherit; }
#iz-app h1, #iz-app h2, #iz-app h3, #iz-app h4 { margin: 0; padding: 0; line-height: 1.3; }
#iz-app p { margin: 0; }
#iz-app button { font-family: inherit; cursor: pointer; }
#iz-app .iz-hidden { display: none !important; }
#iz-app .iz-no-print { /* visible */ }

/* ========== HEADER ========== */
.iz-header {
  background: linear-gradient(135deg, var(--iz-navy-dark) 0%, var(--iz-navy) 50%, var(--iz-navy-medium) 100%);
  color: white;
  position: relative;
  overflow: hidden;
  padding: 18px 22px 12px;
  margin-bottom: 0;
}
.iz-header::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 60%; height: 200%;
  background: radial-gradient(circle, rgba(201, 165, 92, 0.18) 0%, transparent 60%);
  pointer-events: none;
}
.iz-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  position: relative; z-index: 2;
}
.iz-header-brand { display: flex; align-items: center; gap: 14px; }
.iz-logo-box {
  width: 54px; height: 54px;
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.iz-logo-text {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.5px;
}
.iz-logo-text-sm { font-size: 14px; }
.iz-i, .iz-i-text { color: var(--iz-gold-light); }
.iz-z, .iz-z-text { color: white; }
#iz-app .iz-footer .iz-i-text { color: var(--iz-gold-dark); }
#iz-app .iz-footer .iz-z-text { color: var(--iz-navy); }
.iz-brand-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.5px;
  color: white;
}
.iz-brand-sub {
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  margin-top: 2px;
}

.iz-header-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.iz-header-select {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 10px center;
  padding-left: 30px;
}
.iz-header-select option { color: black; background: white; }
.iz-header-btn {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.iz-header-btn:hover { background: rgba(255,255,255,0.18); }
.iz-header-btn-import { cursor: pointer; }

/* Sync status */
.iz-sync-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.iz-sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--iz-gold-light);
  transition: all .25s;
}
.iz-sync-status.saving .iz-sync-dot {
  background: #f4d77c;
  animation: izPulse 1s infinite;
}
.iz-sync-status.saved .iz-sync-dot { background: #5fd585; }
.iz-sync-status.error .iz-sync-dot { background: #ff6b75; animation: izBlink 1s infinite; }
.iz-sync-status.offline .iz-sync-dot { background: #d4a574; }

@keyframes izPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
@keyframes izBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.iz-last-edit {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 0;
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  position: relative; z-index: 2;
}
.iz-last-edit img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }
.iz-last-edit strong { color: var(--iz-gold-light); font-weight: 600; }

/* ========== KPI ROW ========== */
.iz-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 16px 22px 0;
  background: linear-gradient(180deg, var(--iz-navy-medium) 0%, transparent 50%);
}
.iz-kpi {
  padding: 16px 18px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.iz-kpi:hover { transform: translateY(-2px); }
.iz-kpi-icon {
  position: absolute; top: 10px; left: 12px;
  font-size: 22px; opacity: 0.45;
}
.iz-kpi-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.iz-kpi-value {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 4px;
}
.iz-kpi-sub { font-size: 11px; opacity: 0.8; }

.iz-kpi-navy { background: linear-gradient(135deg, var(--iz-navy-dark), var(--iz-navy)); color: white; box-shadow: 0 4px 14px rgba(10, 23, 51, 0.25); }
.iz-kpi-gold { background: linear-gradient(135deg, var(--iz-gold), var(--iz-gold-dark)); color: white; box-shadow: 0 4px 14px rgba(201, 165, 92, 0.3); }
.iz-kpi-success { background: linear-gradient(135deg, var(--iz-success), #3d6647); color: white; box-shadow: 0 4px 14px rgba(74, 124, 89, 0.25); }
.iz-kpi-danger { background: linear-gradient(135deg, var(--iz-danger), #8f2a37); color: white; box-shadow: 0 4px 14px rgba(178, 58, 72, 0.25); }
.iz-kpi-cream { background: linear-gradient(135deg, var(--iz-cream), var(--iz-gold-pale)); color: var(--iz-navy-dark); border: 1px solid var(--iz-gold-pale); box-shadow: 0 2px 8px rgba(201, 165, 92, 0.15); }

/* ========== TABS ========== */
.iz-tabs-wrap { padding: 14px 22px 0; }
.iz-tabs {
  background: white;
  border: 1px solid var(--iz-border-soft);
  border-radius: 14px;
  padding: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
  overflow-x: auto;
  box-shadow: 0 1px 2px rgba(10, 23, 51, 0.03);
}
.iz-tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--iz-text-soft);
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: all .2s;
}
.iz-tab:hover:not(.active) { background: var(--iz-bg); color: var(--iz-navy); }
.iz-tab.active {
  background: linear-gradient(135deg, var(--iz-navy) 0%, var(--iz-navy-medium) 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(20, 40, 80, 0.25);
}
.iz-tab.active .iz-tab-icon { filter: brightness(1.15); }
.iz-tab-icon { font-size: 14px; }

/* ========== MAIN ========== */
.iz-main {
  padding: 14px 22px 40px;
  display: flex; flex-direction: column; gap: 16px;
}
.iz-tab-content { display: flex; flex-direction: column; gap: 16px; }

/* ========== CARDS ========== */
.iz-card {
  background: var(--iz-surface);
  border: 1px solid var(--iz-border-soft);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(10, 23, 51, 0.03), 0 4px 16px rgba(10, 23, 51, 0.04);
}
.iz-card-gold {
  background: linear-gradient(135deg, var(--iz-cream) 0%, #fdf5e3 100%);
  border-color: var(--iz-gold-pale);
}
.iz-card-navy {
  background: linear-gradient(135deg, var(--iz-navy-dark) 0%, var(--iz-navy) 100%);
  color: white;
  border: none;
}
.iz-card-navy h1, .iz-card-navy h2, .iz-card-navy h3 { color: white; }
.iz-card-navy .iz-section-sub { color: rgba(255,255,255,0.78); }
.iz-card-navy .iz-on-dark { color: rgba(255,255,255,0.78); }
.iz-card-danger { border: 2px solid var(--iz-danger-bg); }
.iz-card-table { padding: 0; }
.iz-card-table .iz-table-wrap { padding: 0; }

.iz-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--iz-text-soft); letter-spacing: 0.4px; margin-bottom: 8px; }
.iz-card-value { font-size: 24px; font-weight: 900; color: var(--iz-navy-dark); }
.iz-card-sub { font-size: 11px; color: var(--iz-text-muted); margin-top: 4px; }
.iz-text-success { color: var(--iz-success); }
.iz-text-danger { color: var(--iz-danger); }
.iz-text-warning { color: var(--iz-warning); }
.iz-text-navy { color: var(--iz-navy); }
.iz-text-gold { color: var(--iz-gold-dark); }

.iz-card-toolbar {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 12px;
}
.iz-view-toggle {
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  background: var(--iz-bg);
  border: 1px solid var(--iz-border-soft);
  border-radius: 10px;
}
.iz-toggle-btn {
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  color: var(--iz-text-soft);
}
.iz-toggle-btn.active {
  background: white;
  color: var(--iz-navy);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.iz-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ========== SECTION HEADER ========== */
.iz-section-head {
  display: flex; flex-wrap: wrap;
  align-items: flex-start; justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.iz-section-title {
  font-weight: 800;
  font-size: 18px;
  color: var(--iz-navy-dark);
  display: flex; align-items: center; gap: 10px;
}
.iz-section-title-sm { font-size: 16px; }
.iz-section-sub {
  font-size: 13px;
  color: var(--iz-text-soft);
  margin-top: 4px;
  margin-bottom: 14px;
}

.iz-live-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--iz-text-soft);
  font-weight: 500;
}
.iz-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--iz-gold-light);
  box-shadow: 0 0 0 0 rgba(232, 199, 127, 0.7);
  animation: izRadar 2s infinite;
  display: inline-block;
}
@keyframes izRadar {
  0% { box-shadow: 0 0 0 0 rgba(232, 199, 127, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(232, 199, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 199, 127, 0); }
}

/* ========== GRID ========== */
.iz-grid { display: grid; gap: 14px; }
.iz-grid-2 { grid-template-columns: repeat(2, 1fr); }
.iz-grid-3 { grid-template-columns: repeat(3, 1fr); }
.iz-grid-4 { grid-template-columns: repeat(4, 1fr); }
.iz-stack { display: flex; flex-direction: column; gap: 10px; }

.iz-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--iz-gold) 50%, transparent);
  border-radius: 1px;
  margin: 16px 0;
}

/* ========== TABLES ========== */
.iz-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.iz-table-wrap::-webkit-scrollbar { height: 6px; }
.iz-table-wrap::-webkit-scrollbar-track { background: var(--iz-bg); }
.iz-table-wrap::-webkit-scrollbar-thumb { background: var(--iz-border); border-radius: 3px; }

.iz-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  min-width: 700px;
}
.iz-table th {
  background: var(--iz-bg);
  color: var(--iz-text-soft);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--iz-border-soft);
  white-space: nowrap;
}
.iz-table td {
  padding: 12px;
  border-bottom: 1px solid var(--iz-border-soft);
  vertical-align: middle;
}
.iz-table tr:last-child td { border-bottom: none; }
.iz-table tr:hover td { background: rgba(245, 230, 195, 0.15); }
.iz-table tfoot td { background: var(--iz-bg); font-weight: 800; border-top: 2px solid var(--iz-border); }

/* ========== STATUS BADGES ========== */
.iz-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.iz-badge-paid { background: var(--iz-success-bg); color: var(--iz-success); }
.iz-badge-partial { background: var(--iz-warning-bg); color: #8a5a14; }
.iz-badge-unpaid { background: #f0eadc; color: var(--iz-text-soft); }
.iz-badge-sent { background: var(--iz-info-bg); color: var(--iz-info); }
.iz-badge-overdue { background: var(--iz-danger-bg); color: var(--iz-danger); }
.iz-badge-projected { background: var(--iz-gold-pale); color: var(--iz-gold-dark); }
.iz-badge-recurring { background: #e0e7f2; color: var(--iz-navy); }
.iz-badge-onetime { background: #f3e8d8; color: var(--iz-gold-dark); }
.iz-badge-lastmonth { background: var(--iz-danger-bg); color: var(--iz-danger); }
.iz-badge-variable { background: #ebe5f0; color: #6b4a7f; }

/* ========== INPUTS ========== */
.iz-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--iz-border);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  background: white;
  color: var(--iz-text);
  transition: border-color .15s, box-shadow .15s;
}
.iz-input:focus {
  outline: none;
  border-color: var(--iz-gold);
  box-shadow: 0 0 0 3px rgba(201, 165, 92, 0.15);
}
.iz-input:disabled { background: var(--iz-bg); color: var(--iz-text-muted); cursor: not-allowed; }
.iz-input-sm { padding: 7px 10px; font-size: 12.5px; width: auto; }
select.iz-input {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a5a6e' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
  appearance: none;
}
textarea.iz-input { resize: vertical; min-height: 60px; }

.iz-input-inline {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--iz-text);
  font-family: inherit;
  transition: all .15s;
  width: auto;
  max-width: 100%;
}
.iz-input-inline:hover { background: var(--iz-bg); border-color: var(--iz-border-soft); }
.iz-input-inline:focus { outline: none; background: white; border-color: var(--iz-gold); box-shadow: 0 0 0 2px rgba(201, 165, 92, 0.15); }

.iz-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--iz-text-soft);
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

/* ========== BUTTONS ========== */
.iz-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.iz-btn-primary { background: linear-gradient(135deg, var(--iz-navy), var(--iz-navy-medium)); color: white; box-shadow: 0 2px 6px rgba(20, 40, 80, 0.25); }
.iz-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(20, 40, 80, 0.35); }
.iz-btn-gold { background: linear-gradient(135deg, var(--iz-gold), var(--iz-gold-dark)); color: white; box-shadow: 0 2px 6px rgba(201, 165, 92, 0.3); }
.iz-btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(201, 165, 92, 0.4); }
.iz-btn-success { background: var(--iz-success); color: white; }
.iz-btn-success:hover { background: #3d6647; }
.iz-btn-danger { background: var(--iz-danger); color: white; }
.iz-btn-danger:hover { background: #8f2a37; }
.iz-btn-secondary { background: var(--iz-bg); color: var(--iz-text); border: 1px solid var(--iz-border); }
.iz-btn-secondary:hover { background: var(--iz-border-soft); }
.iz-btn-ghost { background: transparent; color: var(--iz-text-soft); padding: 6px 10px; }
.iz-btn-ghost:hover { background: var(--iz-bg); color: var(--iz-navy); }
.iz-btn-sm { padding: 5px 10px; font-size: 12px; }

.iz-action-btn {
  padding: 5px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--iz-text-soft);
  transition: all .15s;
}
.iz-action-btn:hover { background: var(--iz-bg); }
.iz-action-btn.edit:hover { color: var(--iz-navy); background: #e0e7f2; }
.iz-action-btn.delete:hover { color: var(--iz-danger); background: var(--iz-danger-bg); }
.iz-action-btn.collect:hover { color: var(--iz-success); background: var(--iz-success-bg); }
.iz-action-btn-row { display: inline-flex; gap: 4px; }

/* ========== MODAL ========== */
.iz-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 23, 51, 0.55);
  backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: izFadeIn .2s ease;
}
.iz-modal {
  background: white;
  border-radius: 18px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(10, 23, 51, 0.3);
  animation: izSlideUp .25s ease;
  display: flex; flex-direction: column;
}
.iz-modal-header {
  padding: 22px 28px 12px;
  border-bottom: 1px solid var(--iz-border-soft);
  position: sticky; top: 0; background: white; z-index: 2;
  border-radius: 18px 18px 0 0;
}
.iz-modal-header-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.iz-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--iz-navy-dark);
}
.iz-modal-body { padding: 22px 28px; }
.iz-modal-footer {
  padding: 16px 28px 22px;
  border-top: 1px solid var(--iz-border-soft);
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: white;
  border-radius: 0 0 18px 18px;
  flex-wrap: wrap;
}
@keyframes izFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes izSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ========== TOAST ========== */
.iz-toast {
  position: fixed;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 10px;
  color: white;
  font-weight: 700;
  font-size: 13.5px;
  z-index: 999999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: izToastIn .3s ease;
  max-width: 90vw;
}
@keyframes izToastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ========== UTILITIES ========== */
.iz-currency-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  vertical-align: middle;
  margin-right: 4px;
}
.iz-currency-EGP { background: var(--iz-danger-bg); color: var(--iz-danger); }
.iz-currency-USD { background: var(--iz-success-bg); color: var(--iz-success); }
.iz-currency-SAR { background: var(--iz-info-bg); color: var(--iz-info); }

.iz-service-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--iz-bg);
  color: var(--iz-text-soft);
  border: 1px solid var(--iz-border-soft);
  margin: 2px;
}
.iz-service-tag-sm { padding: 2px 7px; font-size: 10px; }

.iz-checkbox-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--iz-border);
  border-radius: 10px;
  cursor: pointer;
  background: white;
  transition: all .15s;
}
.iz-checkbox-card:hover { border-color: var(--iz-gold-light); background: var(--iz-cream); }
.iz-checkbox-card.checked { border-color: var(--iz-gold); background: var(--iz-cream); box-shadow: 0 0 0 3px rgba(201, 165, 92, 0.1); }
.iz-checkbox-card input { width: 18px; height: 18px; accent-color: var(--iz-gold-dark); }

.iz-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--iz-border-soft);
  border-radius: 3px;
  overflow: hidden;
}
.iz-progress-fill { height: 100%; transition: width .4s ease; }
.iz-progress-fill.success { background: linear-gradient(90deg, var(--iz-success), #6ba074); }
.iz-progress-fill.warning { background: linear-gradient(90deg, var(--iz-warning), var(--iz-gold-light)); }
.iz-progress-fill.danger { background: linear-gradient(90deg, var(--iz-danger), #d35e6c); }
.iz-progress-fill.gold { background: linear-gradient(90deg, var(--iz-gold-dark), var(--iz-gold-light)); }

.iz-month-card {
  transition: all .2s ease;
  cursor: pointer;
}
.iz-month-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(10, 23, 51, 0.08); }
.iz-month-card.active { border: 2px solid var(--iz-gold); box-shadow: 0 0 0 4px rgba(201, 165, 92, 0.1); }

.iz-empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--iz-text-muted);
}
.iz-empty-state-icon {
  font-size: 44px;
  opacity: 0.4;
  margin-bottom: 12px;
  display: block;
}

.iz-equiv {
  display: flex; align-items: center;
  font-size: 14px;
  background: var(--iz-gold-pale);
  color: var(--iz-navy-dark);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
}
.iz-equiv-value { font-weight: 800; margin: 0 4px; }
.iz-muted { color: var(--iz-text-muted); }

.iz-footer {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--iz-text-soft);
  border-top: 1px solid var(--iz-border-soft);
  margin-top: 20px;
}

/* ========== AUDIT LOG ========== */
.iz-audit-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--iz-bg);
  border: 1px solid var(--iz-border-soft);
}
.iz-audit-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--iz-gold-pale);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--iz-navy-dark);
  flex-shrink: 0;
  overflow: hidden;
}
.iz-audit-avatar img { width: 100%; height: 100%; object-fit: cover; }
.iz-audit-content { flex: 1; min-width: 0; }
.iz-audit-name { font-weight: 700; color: var(--iz-navy); font-size: 13.5px; }
.iz-audit-desc { color: var(--iz-text-soft); font-size: 12.5px; margin-top: 2px; }
.iz-audit-time { font-size: 11.5px; color: var(--iz-text-muted); white-space: nowrap; flex-shrink: 0; }

/* ========== RESPONSIVE MOBILE ========== */

/* Medium tablets */
@media (max-width: 1024px) {
  .iz-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .iz-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .iz-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Small tablets / large phones */
@media (max-width: 768px) {
  .iz-header { padding: 14px 16px 10px; }
  .iz-header-inner { gap: 10px; }
  .iz-logo-box { width: 46px; height: 46px; border-radius: 13px; }
  .iz-brand-title { font-size: 22px; }
  .iz-brand-sub { font-size: 11.5px; }
  .iz-logo-text { font-size: 24px; }

  .iz-header-actions { width: 100%; justify-content: stretch; }
  .iz-header-actions > * { flex: 1; min-width: 0; justify-content: center; }
  .iz-header-select { flex-basis: 100%; }
  .iz-sync-status { flex-basis: 100%; justify-content: center; }
  .iz-header-btn span { font-size: 11.5px; }

  .iz-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    padding: 14px 16px 0;
    gap: 10px;
  }
  .iz-kpi { padding: 12px 14px; }
  .iz-kpi-value { font-size: 17px; }
  .iz-kpi-label { font-size: 10px; }
  .iz-kpi-sub { font-size: 10px; }

  .iz-tabs-wrap { padding: 10px 16px 0; }
  .iz-tab { padding: 8px 11px; font-size: 12px; }

  .iz-main { padding: 10px 16px 30px; gap: 12px; }
  .iz-card { padding: 16px; border-radius: 12px; }

  .iz-grid-2, .iz-grid-3, .iz-grid-4 { grid-template-columns: 1fr; }
  .iz-section-title { font-size: 16px; }
  .iz-section-title-sm { font-size: 14.5px; }
  .iz-section-sub { font-size: 12px; }

  .iz-card-toolbar { flex-direction: column; align-items: stretch; }
  .iz-view-toggle { width: 100%; }
  .iz-view-toggle .iz-toggle-btn { flex: 1; text-align: center; }
  .iz-toolbar-actions { width: 100%; }
  .iz-toolbar-actions .iz-input { flex: 1; min-width: 0; }
  .iz-toolbar-actions .iz-btn { flex-shrink: 0; }

  /* Tables: hide low-priority columns */
  .iz-hide-sm { display: none !important; }
  .iz-table { font-size: 12.5px; min-width: 0; }
  .iz-table th, .iz-table td { padding: 9px 8px; }

  /* Modal: nearly full-screen */
  .iz-modal-overlay { padding: 0; }
  .iz-modal { max-height: 100vh; border-radius: 0; }
  .iz-modal-header, .iz-modal-body, .iz-modal-footer { padding-left: 18px; padding-right: 18px; }
  .iz-modal-footer { flex-direction: column-reverse; }
  .iz-modal-footer .iz-btn { width: 100%; justify-content: center; }
}

/* Phones */
@media (max-width: 480px) {
  .iz-header { padding: 12px 12px 8px; }
  .iz-tab-label { display: none; }
  .iz-tab { padding: 8px 12px; }
  .iz-tab-icon { font-size: 16px; }
  .iz-tab.active .iz-tab-label { display: inline; font-size: 11.5px; }

  .iz-hide-md { display: none !important; }
  .iz-kpi { padding: 10px 12px; }
  .iz-kpi-value { font-size: 15px; }

  .iz-header-actions .iz-header-btn span { display: none; }
  .iz-header-actions .iz-header-btn { padding: 9px; }
  .iz-sync-status { padding: 5px 10px; font-size: 11px; }

  .iz-main { padding: 10px 12px 30px; }
  .iz-card { padding: 14px; }

  .iz-table th, .iz-table td { padding: 8px 6px; font-size: 11.5px; }
  .iz-btn { padding: 8px 12px; font-size: 12px; }
  .iz-action-btn-row { gap: 2px; }

  .iz-toast { top: 50px; font-size: 12px; padding: 10px 16px; }
}

/* WP admin compatibility */
.iz-wrap h1, .iz-wrap h2, .iz-wrap h3 { font-family: inherit; }
#iz-app input[type=number]::-webkit-inner-spin-button { opacity: 1; }
#iz-app input[type=date], #iz-app input[type=month] { font-family: inherit; }
#iz-app button:focus { outline: none; }
#iz-app button:focus-visible { outline: 2px solid var(--iz-gold); outline-offset: 1px; }
#iz-app a { color: var(--iz-navy); }

/* Hide WP admin notices inside our page so they don't break the layout */
.iz-page-active #wpbody-content > .notice,
.iz-page-active #wpbody-content > .updated,
.iz-page-active #wpbody-content > .error {
  margin: 10px 20px;
}

/* Print */
@media print {
  .iz-no-print { display: none !important; }
  #adminmenumain, #wpadminbar, #wpfooter { display: none !important; }
  #wpcontent, #wpbody, #wpbody-content { padding: 0 !important; margin: 0 !important; }
  .iz-wrap { margin: 0 !important; }
  #iz-app { background: white !important; padding: 0 !important; }
  .iz-card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  .iz-header { background: var(--iz-navy-dark) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ========== FRONTEND CONTEXT (shortcode) ========== */
.iz-frontend-wrap {
  margin: 0;
  padding: 0;
  max-width: 100%;
}
#iz-app.iz-context-frontend {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 30px rgba(10, 23, 51, 0.08);
  max-width: 1280px;
  margin: 20px auto;
}
.iz-context-frontend .iz-header { padding-top: 22px; }

/* Readonly indicator */
body.iz-readonly #iz-app::before {
  content: "👁 وضع العرض فقط";
  display: block;
  background: linear-gradient(135deg, var(--iz-warning), var(--iz-gold-light));
  color: var(--iz-navy-dark);
  text-align: center;
  padding: 6px;
  font-weight: 700;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
body.iz-readonly .iz-input[readonly],
body.iz-readonly .iz-input[disabled] {
  background: var(--iz-bg) !important;
  cursor: not-allowed;
}

/* ========== MOBILE POLISH v2.1 ========== */

/* Standalone page: smaller header on mobile */
.iz-standalone-body #iz-app {
  border-radius: 0;
  margin: 0;
  max-width: 100%;
  box-shadow: none;
  min-height: calc(100vh - 50px);
}
.iz-standalone-body .iz-header { border-radius: 0; }

/* Better touch targets on mobile */
@media (max-width: 768px) {
  .iz-btn, .iz-header-btn, .iz-tab {
    min-height: 40px;
  }
  .iz-action-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
  }
  /* Make tab strip horizontally scrollable with momentum */
  .iz-tabs-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .iz-tabs-wrap::-webkit-scrollbar { display: none; }
  .iz-tabs { flex-wrap: nowrap; min-width: max-content; }

  /* Tables: horizontal scroll with hint */
  .iz-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    position: relative;
  }
  .iz-table {
    min-width: 100%;
  }
  /* Make inputs comfortable to tap */
  .iz-input, .iz-input-inline {
    font-size: 16px !important; /* prevent iOS zoom */
    min-height: 40px;
    padding: 9px 12px;
  }
  .iz-input-inline { min-height: 36px; padding: 6px 10px; }
  textarea.iz-input { min-height: 80px; }

  /* KPI: single row of horizontal scroll cards on very small screens */
  .iz-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .iz-kpi { min-height: 80px; }

  /* Toast positioning above WP admin bar */
  .iz-toast {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    top: 56px;
  }

  /* Standalone topbar collision with WP admin bar */
  .iz-standalone-body .iz-standalone-topbar { top: 0; }
  html.wp-toolbar .iz-standalone-body .iz-standalone-topbar { top: 46px; }
}

@media (max-width: 480px) {
  /* Single-column KPIs on tiny phones */
  .iz-kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 12px 0; }
  .iz-kpi { padding: 10px; min-height: 70px; }
  .iz-kpi-value { font-size: 14px; }
  .iz-kpi-icon { font-size: 18px; }
  .iz-kpi-label { font-size: 9.5px; }

  /* More compact header on mobile */
  .iz-header { padding: 10px 12px 6px; }
  .iz-header-inner { flex-direction: column; align-items: flex-start; }
  .iz-brand-title { font-size: 18px; }
  .iz-brand-sub { font-size: 10.5px; }
  .iz-logo-box { width: 38px; height: 38px; }
  .iz-logo-text { font-size: 19px; }

  /* Header actions wrap properly */
  .iz-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .iz-header-select { grid-column: span 2; }
  .iz-sync-status { grid-column: span 2; }

  /* Tab labels only on active */
  .iz-tab { padding: 8px 10px; font-size: 11px; gap: 4px; }
  .iz-tab-icon { font-size: 15px; }

  /* Card padding reduce */
  .iz-main { padding: 8px 10px 24px; gap: 10px; }
  .iz-card { padding: 12px; border-radius: 10px; }

  /* Modals full-screen */
  .iz-modal-overlay { padding: 0; align-items: stretch; }
  .iz-modal {
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    width: 100%;
  }
  .iz-modal-body { padding: 14px; max-height: calc(100vh - 130px); }
  .iz-modal-header { padding: 12px 14px; }
  .iz-modal-footer {
    padding: 12px 14px;
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--iz-border-soft);
  }

  /* Reduce table cell padding */
  .iz-table th, .iz-table td {
    padding: 7px 5px;
    font-size: 11px;
  }
  .iz-table th { font-size: 10px; }

  /* Stack the profit "summary line" on mobile */
  #profitCalculation > div:last-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  #profitCalculation > div:last-child > div:last-child {
    font-size: 24px !important;
    width: 100%;
    text-align: center;
  }
}

/* Visual scroll hint for wide tables */
@media (max-width: 768px) {
  .iz-table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(248, 245, 238, 0.9), transparent);
    pointer-events: none;
    z-index: 1;
  }
}

/* Better focus states for touch users */
@media (hover: none) and (pointer: coarse) {
  .iz-btn:active { transform: scale(0.97); }
  .iz-tab:active { background: var(--iz-cream); }
  .iz-action-btn:active { transform: scale(0.92); }
}

/* Readonly badge cleaner */
body.iz-readonly #iz-app::before {
  position: relative;
  top: auto;
  border-radius: 0;
}

/* Loss / negative profit KPI variant */
.iz-kpi-danger {
  background: linear-gradient(135deg, #fff5f5 0%, #fee5e5 100%) !important;
  border: 1px solid #fca5a5 !important;
}
.iz-kpi-danger .iz-kpi-value { color: #b91c1c !important; }
.iz-kpi-danger .iz-kpi-label { color: #991b1b !important; }
.iz-kpi-danger .iz-kpi-sub { color: #c2410c !important; }
.iz-kpi-danger .iz-kpi-icon {
  background: linear-gradient(135deg, #dc2626, #991b1b) !important;
}
