@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* ================================================
   OFFICIAL LETTERS SYSTEM — REDESIGNED
   Professional, Modern, RTL Kurdish Badini
   ================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #1a2e4a;
  --primary-mid:  #243d5c;
  --primary-lite: #2e4f74;
  --accent:       #ffc107;
  --accent-lite:  #ffd54f;
  --success:      #1a7a45;
  --success-bg:   #d6f0e2;
  --danger:       #c0392b;
  --danger-bg:    #fde8e6;
  --warning:      #b7770d;
  --warning-bg:   #fff3cd;
  --info:         #1460a8;
  --info-bg:      #dceeff;
  --bg:           #eef1f6;
  --surface:      #ffffff;
  --border:       #d8dee8;
  --text:         #1c2b3a;
  --muted:        #6b7c93;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 14px rgba(26,46,74,.09);
  --shadow-lg:    0 8px 36px rgba(26,46,74,.16);
  --trans:        .2s ease;
}

html { direction: rtl; text-align: right; scroll-behavior: smooth; }

body {
  font-family: 'Noto Naskh Arabic', 'Tahoma', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  direction: rtl;
}

/* ── Typography ── */
h1 { font-size: 24px; font-weight: 800; color: var(--primary); margin-bottom: 18px; }
h2 { font-size: 19px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
h3 { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
p  { line-height: 1.7; margin-bottom: 10px; }
a  { color: var(--info); text-decoration: none; transition: color var(--trans); }
a:hover { text-decoration: underline; color: var(--primary); }
small { font-size: 12px; color: var(--muted); }
strong { font-weight: 700; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
ul, ol { margin-right: 20px; line-height: 1.9; }

/* ── LTR overrides ── */
input[type="date"],
[dir="ltr"]          { direction: ltr !important; text-align: left !important; }

/* ── Material Icons ── */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal; font-size: 20px;
  line-height: 1; display: inline-block; white-space: nowrap;
  direction: ltr; vertical-align: middle; margin-left: 4px;
}

/* ================================================
   NAVBAR
   ================================================ */
.navbar {
  background: linear-gradient(135deg, #0d1b2e 0%, #1a2e4a 60%, #1f3558 100%);
  color: #fff;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; justify-content: space-between; align-items: center;
  height: calc(62px + env(safe-area-inset-top, 0px));
  box-shadow: 0 2px 20px rgba(0,0,0,.35), 0 1px 0 rgba(255,193,7,.15);
  position: sticky; top: 0; z-index: 900;
  border-bottom: 2px solid rgba(255,193,7,.2);
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 800; white-space: nowrap; flex-shrink: 0;
  letter-spacing: .3px;
}
.navbar-brand .material-symbols-outlined { font-size: 26px; color: var(--accent); margin: 0; }
.navbar-links { display: flex; align-items: center; gap: 1px; }
.navbar a {
  color: rgba(255,255,255,.8); text-decoration: none;
  padding: 6px 10px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .18s ease; white-space: nowrap;
  position: relative;
}
.navbar a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.navbar a.active-nav {
  color: var(--accent) !important;
  background: rgba(255,193,7,.12) !important;
}
.navbar a.active-nav::after {
  content: '';
  position: absolute;
  bottom: -2px; right: 6px; left: 6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.navbar-sep { width:1px; height:22px; background:rgba(255,255,255,.15); margin:0 4px; }

/* ── Admin dropdown ── */
.nav-admin-dropdown { position: relative; display: inline-flex; }
.nav-admin-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,193,7,.12);
  border: 1px solid rgba(255,193,7,.25);
  border-radius: 6px;
  color: var(--accent);
  padding: 5px 10px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
  transition: background .18s;
}
.nav-admin-btn:hover { background: rgba(255,193,7,.22); }
.nav-admin-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background: linear-gradient(180deg, #0f2035 0%, #1a2e4a 100%);
  border: 1px solid rgba(255,193,7,.2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 1000;
  padding: 6px;
  flex-direction: column;
  gap: 2px;
}
.nav-admin-menu.open { display: flex; }
.nav-admin-menu a {
  color: rgba(255,255,255,.85) !important;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.nav-admin-menu a:hover {
  background: rgba(255,193,7,.12) !important;
  color: var(--accent) !important;
  transform: none;
}
.nav-admin-menu a .material-symbols-outlined {
  font-size: 17px; color: var(--accent); margin: 0; flex-shrink: 0;
}
.nav-badge {
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 800;
  padding: 1px 6px; margin-right: -2px;
}
/* ── Notification Bell ── */
/* Mobile toggle */
.navbar-toggle {
  display: none; background: none; border: none;
  color: #fff; cursor: pointer; padding: 6px; position: relative;
}
.navbar-toggle .material-symbols-outlined { font-size: 26px; margin: 0; transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s ease; }
.navbar-toggle.is-open .material-symbols-outlined { transform: rotate(90deg); }
.toggle-badge {
  position: absolute; top: 4px; left: 4px;
  background: var(--danger); color: #fff;
  border-radius: 8px; font-size: 9px; font-weight: 800; padding: 1px 4px;
}
/* Drawer */
.nav-drawer {
  display: flex; position: fixed;
  top: calc(62px + env(safe-area-inset-top, 0px)); right: 0; left: 0; bottom: 0;
  background: linear-gradient(180deg, #0d1b2e 0%, #1a2e4a 100%);
  z-index: 899;
  overflow-y: auto; padding: 12px;
  flex-direction: column; gap: 3px;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s ease;
  visibility: hidden;
}
.nav-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}
.nav-drawer a {
  color: rgba(255,255,255,.85); padding: 12px 16px;
  border-radius: 8px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; transition: all .15s ease;
  border: 1px solid transparent;
}
.nav-drawer a:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.1);
  color: #fff;
}
.drawer-sep { height: 1px; background: rgba(255,255,255,.1); margin: 8px 0; }
.drawer-admin {
  background: rgba(255,193,7,.06);
  border: 1px solid rgba(255,193,7,.15);
  border-radius: 10px;
  padding: 6px;
  margin-top: 4px;
}
.drawer-admin a { color: var(--accent) !important; }
.drawer-admin a:hover { background: rgba(255,193,7,.1) !important; }
/* Welcome message in navbar */
.navbar-welcome {
  color: rgba(255,255,255,.90); font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
/* Welcome block at top of mobile drawer */
.drawer-welcome {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 15px; font-weight: 700;
  padding: 14px 16px;
  background: rgba(255,193,7,.08);
  border: 1px solid rgba(255,193,7,.2);
  border-radius: 10px;
  margin-bottom: 4px;
}
.drawer-welcome .material-symbols-outlined { font-size: 22px; color: var(--accent); margin: 0; }

/* ================================================
   CONTAINER & LAYOUT
   ================================================ */
.container { max-width: 1200px; margin: 26px auto; padding: 0 20px; direction: rtl; }

/* ================================================
   CARDS
   ================================================ */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px;
  border: 1px solid var(--border); direction: rtl; text-align: right;
  overflow: hidden;
}
.card h1, .card h2, .card h3 { text-align: right; }

/* Stat card */
.stat-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  border-radius: var(--radius); padding: 22px 18px; text-align: center;
  box-shadow: var(--shadow-lg); border: none; color: #fff;
}
.stat-icon  { font-size: 46px !important; color: var(--accent); display: block; margin-bottom: 8px; }
.stat-num   { font-size: 38px; font-weight: 800; margin: 0; color: #fff; }
.stat-lbl   { font-size: 14px; opacity: .85; margin: 6px 0 0; color: #fff; }

/* ================================================
   ALERTS
   ================================================ */
.alert {
  padding: 8px 12px; border-radius: var(--radius-sm);
  margin-bottom: 10px; display: flex; align-items: center;
  gap: 8px; font-size: 13px; font-weight: 600;
}
.alert .material-symbols-outlined { font-size: 16px; flex-shrink: 0; }
.alert-success { background: var(--success-bg); color: var(--success); border-right: 3px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-right: 3px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-right: 3px solid var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-right: 3px solid var(--info); }
/* Mobile active nav */
.nav-drawer a.active-nav {
  color: var(--accent) !important;
  background: rgba(255,193,7,.1) !important;
  border-color: rgba(255,193,7,.2) !important;
}
/* Legacy */
.success { background: var(--success-bg); color: var(--success); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; border-right: 4px solid var(--success); font-weight: 600; }
.error   { background: var(--danger-bg);  color: var(--danger);  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; border-right: 4px solid var(--danger);  font-weight: 600; }

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background var(--trans), box-shadow var(--trans), transform var(--trans);
  font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--primary-mid); box-shadow: 0 4px 14px rgba(26,46,74,.25); transform: translateY(-1px); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(0); }
.btn .material-symbols-outlined { font-size: 16px; margin: 0; }
.btn-accent   { background: var(--accent); color: #1a2e4a; }
.btn-accent:hover { background: var(--accent-lite); color: #1a2e4a; }
.btn-success  { background: var(--success); }
.btn-success:hover { background: #145e35; }
.btn-danger   { background: var(--danger); }
.btn-danger:hover { background: #a12820; }
.btn-secondary { background: #6b7c93; }
.btn-secondary:hover { background: #556070; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-sm .material-symbols-outlined { font-size: 14px; }
button.btn { font-family: inherit; }

/* ================================================
   FORMS
   ================================================ */
form { direction: rtl; }
.form-group { margin-bottom: 18px; }
.form-group label { display:block; font-size:13px; font-weight:700; color:#1a2e4a; margin-bottom:6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 2px solid #d0d7e3;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #1a2e4a;
  background: #fff;
  transition: border-color .2s;
  box-sizing: border-box;
  outline: none;
  direction: rtl;
}
.form-control:focus { border-color: #1a2e4a; box-shadow: 0 0 0 3px rgba(26,46,74,.08); }
.form-control[readonly] { background: #f8fafc; color: #888; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 90px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; text-align: right; }

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="url"], input[type="number"],
textarea, select {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface);
  transition: border-color var(--trans), box-shadow var(--trans);
  direction: rtl; text-align: right;
  box-sizing: border-box; max-width: 100%;
}
input[type="date"] { direction: ltr; text-align: left; }
input[type="text"]:focus, input[type="password"]:focus,
input[type="email"]:focus, input[type="date"]:focus,
input[type="url"]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,46,74,.11);
}
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-left: 8px; accent-color: var(--primary); }
input[type="file"] {
  padding: 10px; border: 2px dashed var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  direction: ltr; text-align: left; background: #fafbfc;
}
input[type="file"]::-webkit-file-upload-button {
  padding: 7px 14px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
  margin-left: 10px; font-family: inherit;
}

/* ================================================
   TABLES
   ================================================ */
.table-wrap { width: 100%; max-width: 100%; border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; overflow-y: visible; display: block; box-sizing: border-box; scroll-behavior: auto; }
table { width: 100%; border-collapse: collapse; direction: rtl; }
table th, table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
table th { background: var(--primary); color: #fff; font-weight: 700; font-size: 12px; white-space: nowrap; }
table tbody tr:hover { background: #f5f8fc; }
table tbody tr:last-child td { border-bottom: none; }

/* ================================================
   BADGES
   ================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge .material-symbols-outlined { font-size: 12px; margin: 0; }
.badge-unread   { background: var(--warning-bg); color: var(--warning); }
.badge-read     { background: var(--success-bg); color: var(--success); }
.badge-info     { background: var(--info-bg);    color: var(--info); }
.badge-admin    { background: var(--accent);     color: var(--primary); }

/* ================================================
   TRACKING BAR
   ================================================ */
.tracking-bar {
  display: flex; border-radius: var(--radius);
  overflow: hidden; border: 2px solid var(--border);
  margin: 16px 0;
}
.tracking-step {
  flex: 1; padding: 12px 10px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #f7f9fc; border-left: 1px solid var(--border);
  transition: background var(--trans);
}
.tracking-step:last-child { border-left: none; }
.tracking-step .material-symbols-outlined { font-size: 22px; margin: 0; }
.tracking-step.done   { background: var(--success-bg); color: var(--success); }
.tracking-step.active { background: var(--info-bg);    color: var(--info); }

/* ================================================
   SEARCH BAR
   ================================================ */
.search-bar {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.sf-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 150px; }
.sf-group label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0; }
.sf-group input, .sf-group select {
  padding: 9px 12px; font-size: 13px; margin: 0;
  border: 2px solid #d0d7e3; border-radius: 8px;
  font-family: inherit; color: #1a2e4a; background: #fff;
  outline: none; width: 100%; box-sizing: border-box;
  -webkit-appearance: none; appearance: none;
  min-height: 42px;
}
.sf-group input:focus, .sf-group select:focus { border-color: #1a2e4a; }
.sf-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%231a2e4a' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
.sf-actions { display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; }

/* ================================================
   REPLY THREAD
   ================================================ */
.reply-thread { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.reply-item {
  background: #f5f8fc; border-radius: var(--radius-sm);
  padding: 14px 16px; border-right: 3px solid var(--border);
}
.reply-item.mine { background: #eaf0fb; border-right-color: var(--primary); }
.reply-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.reply-body { font-size: 14px; line-height: 1.7; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lite) 100%);
  padding: 20px;
}
.login-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 40px 36px; width: 420px; max-width: 100%;
  box-shadow: var(--shadow-lg); direction: rtl; text-align: center;
}
.login-box h2 { color: var(--primary); font-size: 22px; margin-bottom: 6px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-box input {
  width: 100%; padding: 13px 14px; margin: 8px 0;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; text-align: right; direction: rtl;
}
.login-box input:focus { border-color: var(--primary); outline: none; }
.login-box button {
  width: 100%; padding: 14px; margin-top: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: opacity var(--trans), transform var(--trans);
}
.login-box button:hover { opacity: .9; transform: translateY(-1px); }

/* ================================================
   UTILITIES
   ================================================ */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.text-center { text-align: center !important; }
.text-muted  { color: var(--muted) !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-20 { margin-top: 20px !important; }

/* ================================================
   LETTER PREVIEW (kept from original)
   ================================================ */
.letter-preview { direction: rtl; text-align: right; }
.letter-preview .letterhead { text-align: center; }

/* ================================================
   MODAL
   ================================================ */
.modal {
  display: none; position: fixed; z-index: 1000;
  inset: 0; background: rgba(0,0,0,.5); padding: 20px; overflow-y: auto;
}
.modal-content {
  background: var(--surface); margin: 40px auto; padding: 28px;
  border-radius: var(--radius); width: 600px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; direction: rtl;
  box-shadow: var(--shadow-lg);
}
.close {
  float: left; font-size: 26px; font-weight: bold;
  cursor: pointer; color: var(--muted); line-height: 1;
  background: none; border: none;
}
.close:hover { color: var(--danger); }

/* ================================================
   PRINT
   ================================================ */
@media print {
  .no-print, .navbar, nav, button, .btn, a.btn { display: none !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .letter-preview { box-shadow: none !important; border: none !important; }
}

/* ================================================
   RESPONSIVE — TABLET
   ================================================ */
@media (max-width: 1024px) {
  .container { padding: 0 14px; }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}

/* ================================================
   RESPONSIVE — MOBILE
   ================================================ */
@media (max-width: 768px) {
  body { font-size: 14px; }
  h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
  .container { padding: 0 12px; margin: 14px auto; }

  .navbar { padding: 0 14px; padding-top: env(safe-area-inset-top, 0px); height: calc(56px + env(safe-area-inset-top, 0px)); }
  .navbar-links { display: none; }
  .navbar-toggle { display: flex; }
  .nav-drawer { top: calc(56px + env(safe-area-inset-top, 0px)); }

  .card { padding: 16px; margin-bottom: 14px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr !important; gap: 12px; }
  div[style*="grid-template-columns: repeat(3"] { grid-template-columns: 1fr !important; gap: 12px !important; }
  div[style*="grid-template-columns: repeat(2"] { grid-template-columns: 1fr !important; gap: 12px !important; }
  .info-form-grid { grid-template-columns: 1fr !important; }



  .btn { padding: 10px 14px; font-size: 13px; }

  input[type="text"], input[type="password"], input[type="email"],
  input[type="date"], textarea, select {
    padding: 11px 13px; font-size: 14px; max-width: 100%;
  }
  input[type="date"] { width: auto; max-width: 100% !important; box-sizing: border-box !important; }

  .modal-content { padding: 20px; margin: 10px auto; width: 100%; }

  .search-row { flex-direction: column; }
  .sf-group { min-width: 100%; }
  .sf-actions { width: 100%; }
  .sf-actions .btn { flex: 1; justify-content: center; }

  .tracking-bar { flex-direction: column; }
  .tracking-step { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 14px; border-left: none; border-bottom: 1px solid var(--border); }
  .tracking-step:last-child { border-bottom: none; }

  .letter-preview { width: 100% !important; margin: 8px 0 !important; }
  .letterhead { grid-template-columns: 1fr !important; padding: 12px !important; text-align: center !important; }
  .header-right, .header-left, .header-center { text-align: center !important; width: 100%; }
  .signature-stamp-area { flex-direction: column !important; align-items: center !important; }
  .stamp-box { position: static !important; text-align: center !important; margin: 15px auto 0 !important; }
  .signature-box { position: static !important; width: 100% !important; text-align: center !important; }
  .letter-content { padding: 16px !important; }

  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .container { padding: 0 8px; }
  .card { padding: 12px; }
  .btn { padding: 9px 12px; font-size: 12px; }
  table th, table td { padding: 4px 6px; font-size: 11px; }
  input[type="date"] { font-size: 13px; }
}

/* Pagination */
.pagination-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:16px;padding-top:12px;border-top:1px solid var(--border);}
.page-btn{padding:5px 11px;border:2px solid var(--primary);border-radius:6px;background:#fff;color:var(--primary);cursor:pointer;font-size:13px;font-weight:700;transition:.15s;}
.page-btn.active{background:var(--primary);color:#fff;}
.page-btn:hover:not(.active):not(:disabled){background:#f0f4fa;}
.page-btn:disabled{opacity:.35;cursor:default;pointer-events:none;}
.per-page-sel{padding:5px 8px;border:2px solid var(--primary);border-radius:6px;font-weight:700;color:var(--primary);background:#fff;cursor:pointer;}
.page-info{font-size:12px;color:#888;margin-right:auto;}