/* ============================================================
   Havana ADMIN visual identity — extracted from havana-jo.com/login
   Palette: forest #2D5A4A + gold #c9a14a on cream #f9f5ed.
   Layout: right-side icon nav rail + top bar with search & user chip.
   Font: Tajawal. Drop-in class names compatible with the app.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --forest: #2D5A4A;
  --forest-dark: #1e3f33;
  --forest-soft: rgba(45,90,74,.10);
  --forest-soft2: rgba(45,90,74,.16);
  --gold: #c9a14a;
  --gold-dark: #a9842f;
  --gold-light: #efe2c4;
  --cream: #f9f5ed;

  --text-primary: #1e293b;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --bg-white: #ffffff;
  --bg-light: #f8faf9;
  --bg-cream: #f9f5ed;

  --success: #2D5A4A;
  --success-bright: #2e8b57;
  --warning: #d97706;
  --warning-bg: #fef3e2;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2D5A4A;

  --border: #e4e9e6;
  --border-soft: #f1f5f3;

  --shadow-sm: 0 1px 3px rgba(30,63,51,.08);
  --shadow-md: 0 4px 14px rgba(30,63,51,.10);
  --shadow-lg: 0 10px 28px rgba(30,63,51,.16);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 30px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Tajawal', system-ui, 'Segoe UI', Tahoma, sans-serif;
  background: var(--cream); color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--forest); text-decoration: none; }

/* ---------- Layout shell: content + right icon rail ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* Icon nav rail (sits on the right in RTL) */
.sidebar {
  width: 96px; flex: 0 0 96px;
  background: var(--bg-white); border-inline-end: 1px solid var(--border);
  padding: 12px 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  box-shadow: -2px 0 10px rgba(30,63,51,.04);
}
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
  font-weight: 800; color: var(--forest); font-size: 13px; text-align: center;
}
.brand img { width: 46px; height: 46px; object-fit: contain; border-radius: 12px;
  background: var(--cream); padding: 4px; border: 1px solid var(--border); }
.brand .muted { font-size: 10px; font-weight: 600; color: var(--gold-dark); }

.nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 10px 4px; margin: 2px 4px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 11px; font-weight: 600; text-align: center;
  line-height: 1.25; transition: all .18s ease; min-height: 58px;
}
.nav-link .nav-ico {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--bg-light); color: var(--text-muted); font-size: 16px;
  transition: all .18s ease;
}
.nav-link:hover { background: var(--bg-light); color: var(--forest); }
.nav-link:hover .nav-ico { color: var(--forest); }
.nav-link.active { color: var(--forest); font-weight: 800; }
.nav-link.active .nav-ico { background: var(--forest); color: #fff; box-shadow: var(--shadow-sm); }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-white); padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.topbar .search {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--border-soft); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 9px 16px; color: var(--text-muted); font-size: 13.5px;
}
.topbar .search input { border: none; background: transparent; outline: none; flex: 1;
  font-family: inherit; font-size: 13.5px; color: var(--text-primary); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-white); color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.icon-btn:hover { border-color: var(--forest); color: var(--forest); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--forest); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.user-chip .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip .who b { font-size: 13px; color: var(--text-primary); }
.user-chip .who span { font-size: 11px; color: var(--text-muted); }

.view { padding: 22px; max-width: 1240px; width: 100%; margin: 0 auto; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin: 0; }

/* ---------- Banner ---------- */
.banner { background: var(--forest-soft); border: 1px solid rgba(45,90,74,.2);
  color: var(--forest-dark); border-radius: var(--radius-md); padding: 12px 16px;
  font-weight: 600; margin-bottom: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card-title { font-size: 17px; font-weight: 800; color: var(--text-primary);
  margin: 0 0 14px; position: relative; padding-bottom: 8px; }
.card-title::after { content: ''; position: absolute; inset-inline-start: 0; bottom: 0;
  width: 42px; height: 3px; border-radius: 3px; background: var(--forest); }

/* stat card with circular icon */
.stat-card { display: flex; align-items: center; gap: 14px; }
.card-ico { width: 48px; height: 48px; flex: none; border-radius: 50%;
  background: var(--forest-soft); color: var(--forest); display: flex; align-items: center;
  justify-content: center; font-size: 20px; }
.card-ico.gold { background: rgba(201,161,74,.16); color: var(--gold-dark); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px,1fr)); gap: 14px; }
.kpi { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.kpi::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: var(--forest); }
.kpi:nth-child(even)::before { background: var(--gold); }
.kpi-value { font-size: 25px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-pill);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .18s ease;
  background: var(--bg-light); color: var(--text-primary); }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--forest); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--forest-dark); }
.btn-success { background: var(--success-bright); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-gold { background: var(--gold); color: #3a2c08; }
.btn-dark { background: var(--text-primary); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--forest); color: var(--forest); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Badges & status ---------- */
.badge, .status { display: inline-block; padding: 3px 11px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; line-height: 1.7; }
.badge-low { background: #eef2f1; color: #647067; }
.badge-medium { background: var(--forest-soft); color: var(--forest); }
.badge-high { background: var(--gold-light); color: var(--gold-dark); }
.badge-urgent { background: var(--warning-bg); color: var(--warning); }
.badge-critical { background: var(--danger-bg); color: var(--danger); }

.status-draft { background: #eef2f1; color: #647067; }
.status-assigned { background: #e8eef0; color: #355b6e; }
.status-accepted { background: var(--forest-soft); color: var(--forest); }
.status-in_progress { background: var(--gold-light); color: var(--gold-dark); }
.status-waiting_for_review { background: var(--warning-bg); color: var(--warning); }
.status-approved_completed { background: var(--forest-soft2); color: var(--forest-dark); }
.status-returned_for_edits { background: var(--warning-bg); color: var(--warning); }
.status-rejected { background: var(--danger-bg); color: var(--danger); }
.status-delayed_overdue { background: var(--danger-bg); color: var(--danger); }
.status-cancelled { background: #eef2f1; color: #90a4a0; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th { text-align: start; padding: 11px 12px; background: var(--bg-light);
  color: var(--text-secondary); font-weight: 700; border-bottom: 2px solid var(--border);
  white-space: nowrap; }
.table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-primary); }
.table tbody tr:hover { background: var(--bg-light); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.input, .select, .textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; background: #fff;
  color: var(--text-primary); transition: border .2s, box-shadow .2s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--forest);
  box-shadow: 0 0 0 3px var(--forest-soft); }
.textarea { min-height: 84px; resize: vertical; }
.checkbox { width: 17px; height: 17px; accent-color: var(--forest); }

/* ---------- Task / list cards ---------- */
.task-card { background: #fff; border: 1px solid var(--border); border-inline-start: 4px solid var(--forest);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.task-card-title { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.task-meta { font-size: 12.5px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13.5px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--gold-light); }
.timeline-item { position: relative; padding: 0 18px 16px; }
.timeline-item::before { content: ''; position: absolute; inset-inline-start: -7px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--forest); border: 2px solid #fff; }

/* ---------- Notifications ---------- */
.notif-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px;
  border-bottom: 1px solid var(--border-soft); }
.notif-unread { background: var(--forest-soft); border-inline-start: 3px solid var(--forest); }

/* ---------- Misc ---------- */
.empty-state { text-align: center; color: var(--text-muted); padding: 28px; font-size: 14px;
  background: var(--bg-light); border: 1px dashed var(--border); border-radius: var(--radius-md); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(30,63,51,.5); display: flex;
  align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: var(--radius-lg); padding: 22px; width: min(520px,92vw);
  box-shadow: var(--shadow-lg); }
.toast { padding: 12px 18px; border-radius: var(--radius-sm); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-md); }
.toast-success { background: var(--forest); }
.toast-error { background: var(--danger); }

/* Floating action buttons */
.fab { position: fixed; bottom: 18px; inset-inline-start: 18px; width: 52px; height: 52px;
  border-radius: 50%; background: var(--forest); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: var(--shadow-lg); }
.fab.fab-2 { bottom: 80px; background: var(--success-bright); }

/* ---------- Responsive: rail -> horizontal top strip ---------- */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100%; }

  .app-shell { flex-direction: column; }

  /* Nav becomes a horizontally-scrollable strip pinned to the top. */
  .sidebar {
    width: 100%; flex: none; height: auto; position: sticky; top: 0; z-index: 50;
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    align-items: center; gap: 4px; padding: 8px; border-inline-end: none;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
  }
  .sidebar::-webkit-scrollbar { height: 0; }
  .brand { flex-direction: row; gap: 8px; border-bottom: none; padding: 4px 8px;
    font-size: 14px; white-space: nowrap; flex: 0 0 auto; }
  .brand img { width: 32px; height: 32px; }
  .brand > div + .muted, .brand .muted { display: none; }
  .nav-link { min-height: auto; flex-direction: row; gap: 6px; padding: 8px 12px;
    white-space: nowrap; flex: 0 0 auto; font-size: 12.5px; }
  .nav-link .nav-ico { width: 26px; height: 26px; }

  .content { width: 100%; min-width: 0; }
  .view { padding: 14px; max-width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }

  .topbar { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .topbar .search { display: none; }
  .user-chip .who { display: none; }
  .page-head h1 { font-size: 18px; }

  /* Wide tables scroll INSIDE their card instead of breaking the page width. */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { white-space: nowrap; min-width: 460px; }

  .fab { width: 46px; height: 46px; bottom: 14px; inset-inline-start: 14px; }
  .fab.fab-2 { bottom: 70px; }
}

/* ============================================================
   Modern polish — smoother, livelier feel
   ============================================================ */
@keyframes wpUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wpFade { from { opacity: 0; } to { opacity: 1; } }

/* cards gently rise in on render */
.card { animation: wpUp .45s cubic-bezier(.22,1,.36,1) both; }

/* tabular figures so count-up doesn't jitter */
.kpi-value { font-variant-numeric: tabular-nums; letter-spacing: .2px; }

/* stat & kpi cards: subtle gradient + hover lift */
.stat-card {
  background: linear-gradient(150deg, #ffffff 0%, #f7faf8 100%);
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi { transition: transform .2s ease, box-shadow .2s ease; }
.stat-card:hover, .kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* icon badge springs slightly on card hover */
.card-ico { transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.stat-card:hover .card-ico { transform: scale(1.1) rotate(-3deg); }

/* banner: soft gradient instead of flat tint */
.banner {
  background: linear-gradient(135deg, rgba(45,90,74,.12), rgba(201,161,74,.12));
  border-color: rgba(45,90,74,.18);
}

/* charts fade in; bars get a soft drop shadow */
.card svg { animation: wpFade .5s ease both; }
.card svg rect { filter: drop-shadow(0 1px 2px rgba(30,63,51,.12)); transition: opacity .2s ease; }
.card svg:hover rect { opacity: .92; }
.card svg rect:hover { opacity: 1; }

/* buttons & nav: a touch smoother */
.btn { transition: transform .15s ease, background .2s ease, box-shadow .2s ease, filter .2s ease; }
.btn:active { transform: translateY(0) scale(.98); }
.nav-link, .nav-link .nav-ico { transition: all .2s ease; }
.table tbody tr { transition: background .15s ease; }

/* respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .card, .card svg { animation: none; }
  .stat-card, .kpi, .card-ico, .btn { transition: none; }
}
