/* ============================================================
   تماسا — Persian Contact Manager
   RTL-first, desktop-optimized, CRM-ready
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Thin.ttf') format('truetype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-ExtraLight.ttf') format('truetype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn FD';
  src: url('assets/fonts/vazirmatn/Vazirmatn-FD-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette — deep indigo + warm accent */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --accent-400: #fb7185;
  --accent-500: #f43f5e;
  --accent-600: #e11d48;

  --teal-500: #14b8a6;
  --amber-500: #f59e0b;

  /* Neutral surfaces (light theme) */
  --bg:          #f4f5fb;
  --bg-soft:     #eceef7;
  --surface:     #ffffff;
  --surface-2:   #f8f9fd;
  --border:      #e6e8f0;
  --border-strong:#d4d7e4;

  --text:        #1e2138;
  --text-2:      #565a76;
  --text-3:      #8b8fa8;
  --text-on-brand:#ffffff;

  /* Status */
  --success: #16a34a;
  --danger:  #e11d48;
  --warning: #d97706;

  /* Avatar palette */
  --ava-1: #6366f1;
  --ava-2: #ec4899;
  --ava-3: #14b8a6;
  --ava-4: #f59e0b;
  --ava-5: #8b5cf6;
  --ava-6: #ef4444;
  --ava-7: #0ea5e9;
  --ava-8: #22c55e;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(30,33,56,.06);
  --shadow-sm: 0 2px 8px rgba(30,33,56,.07);
  --shadow:    0 8px 24px rgba(30,33,56,.09);
  --shadow-lg: 0 18px 48px rgba(30,33,56,.16);

  --sidebar-w: 268px;

  --font: 'Vazirmatn FD', 'Segoe UI', Tahoma, sans-serif;

  --transition: 180ms cubic-bezier(.4,.0,.2,1);
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden; /* app shell handles its own scroll */
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

button { cursor: pointer; border: none; background: none; }

/* Respect the HTML hidden attribute (overrides display on .modal, .empty-state, etc.) */
[hidden] { display: none !important; }

svg.icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
svg.icon--sm { width: 16px; height: 16px; }
svg.icon--lg { width: 24px; height: 24px; }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* Scrollbar (subtle, desktop) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
}
.sidebar__logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.sidebar__brand-name { font-weight: 800; font-size: 19px; color: var(--text); }
.sidebar__brand-sub { font-size: 12px; color: var(--text-3); }

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-align: right;
}
.nav-item:hover { background: var(--brand-50); color: var(--brand-700); }
.nav-item--active { background: var(--brand-600); color: #fff; }
.nav-item--active:hover { background: var(--brand-700); color: #fff; }
.nav-item .icon { color: inherit; }
.nav-item > span:first-of-type { flex: 1; }
.nav-item__count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  min-width: 24px;
  text-align: center;
}
.nav-item--active .nav-item__count { background: rgba(255,255,255,.22); color: #fff; }

.sidebar__section { margin-top: 18px; }
.sidebar__section-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 12px 8px;
}
.sidebar__tags { display: flex; flex-direction: column; gap: 2px; }
.tag-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-align: right;
  width: 100%;
}
.tag-pill:hover { background: var(--bg-soft); color: var(--text); }
.tag-pill--active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.tag-pill__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tag-pill__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-pill__count { font-size: 11px; color: var(--text-3); }
.tag-pill--active .tag-pill__count { color: var(--brand-600); }

.sidebar__tags-empty { padding: 6px 12px; color: var(--text-3); font-size: 12px; }

.sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: right;
  transition: background var(--transition), color var(--transition);
}
.ghost-btn:hover { background: var(--bg-soft); color: var(--text); }
.ghost-btn .icon { color: var(--text-3); transition: color var(--transition); }
.ghost-btn:hover .icon { color: var(--brand-600); }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__search {
  position: relative;
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
}
.topbar__search-icon {
  position: absolute;
  right: 14px;
  color: var(--text-3);
  pointer-events: none;
}
.topbar__input {
  width: 100%;
  padding: 11px 44px 11px 44px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.topbar__input::placeholder { color: var(--text-3); }
.topbar__input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.topbar__clear {
  position: absolute;
  left: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}
.topbar__clear:hover { background: var(--bg-soft); color: var(--text); }

.topbar__actions { margin-right: auto; }

/* Primary button */
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--brand-600);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79,70,229,.28);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.primary-btn:hover { background: var(--brand-700); box-shadow: 0 6px 18px rgba(79,70,229,.36); }
.primary-btn:active { transform: translateY(1px); }

.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(225,29,72,.26);
  transition: background var(--transition), transform var(--transition);
}
.danger-btn:hover { background: #be123c; }
.danger-btn:active { transform: translateY(1px); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  color: var(--brand-600);
  font-size: 13px;
  font-weight: 600;
  transition: color var(--transition);
}
.link-btn:hover { color: var(--brand-700); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 8px;
  gap: 16px;
}
.toolbar__info { display: flex; align-items: baseline; gap: 12px; }
.toolbar__title { font-size: 22px; font-weight: 800; color: var(--text); }
.toolbar__count { font-size: 13px; color: var(--text-3); font-weight: 500; }

.toolbar__sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.toolbar__sort select {
  padding: 8px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.toolbar__sort select:focus { outline: none; border-color: var(--brand-400); }

/* ============================================================
   CONTACTS GRID
   ============================================================ */
.contacts {
  flex: 1;
  overflow-y: auto;
  padding: 12px 32px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-content: start;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: cardIn 320ms cubic-bezier(.16,.84,.44,1) both;
}
.contact-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
}
.contact-card:active { transform: translateY(-1px); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.contact-card__top { display: flex; align-items: center; gap: 12px; }
.contact-card__main { flex: 1; min-width: 0; }
.contact-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-card__sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.contact-card__star {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.contact-card:hover .contact-card__star { opacity: 1; }
.contact-card__star--on { opacity: 1; color: var(--amber-500); }
.contact-card__star:hover { background: var(--bg-soft); }

.contact-card__phone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  direction: ltr;
  justify-content: flex-end;
}
.contact-card__phone .icon { color: var(--brand-500); width: 16px; height: 16px; }

.contact-card__tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 4px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  white-space: nowrap;
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }

/* Avatar */
.avatar {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  user-select: none;
}
.avatar--sm { width: 44px; height: 44px; font-size: 16px; border-radius: 12px; }
.avatar--lg { width: 60px; height: 60px; font-size: 22px; border-radius: 14px; }
.avatar--xl { width: 72px; height: 72px; font-size: 26px; border-radius: 16px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  gap: 8px;
}
.empty-state__art {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--brand-50);
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.empty-state__art svg { width: 56px; height: 56px; fill: var(--brand-300); }
.empty-state h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.empty-state p { color: var(--text-3); margin-bottom: 16px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 33, 56, .42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}
.modal__panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: modalIn 260ms cubic-bezier(.16,.84,.44,1);
}
.modal__panel--sm { max-width: 420px; text-align: center; padding: 32px 28px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__head h2 { font-size: 18px; font-weight: 800; color: var(--text); }

.modal__body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__foot .ghost-btn { width: auto; padding: 10px 18px; border: 1.5px solid var(--border); }
.modal__foot .ghost-btn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.modal__foot .primary-btn,
.modal__foot .danger-btn { margin-right: auto; }

/* Detail head */
.detail-head__id { display: flex; align-items: center; gap: 16px; }
.detail-head__id h2 { font-size: 20px; font-weight: 800; }
.detail-head__id p { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   FORM
   ============================================================ */
.form-row--avatar { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.form-row--avatar .form-row__main { flex: 1; min-width: 0; }

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

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field .req { color: var(--accent-500); }
.field .hint { color: var(--text-3); font-weight: 400; font-size: 11px; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field textarea,
.jdate__input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.field input:focus,
.field textarea:focus,
.jdate__input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }
.field textarea { resize: vertical; min-height: 72px; font-family: inherit; }

.field--error input,
.field--error textarea { border-color: var(--danger); background: #fef2f2; }
.field__error { font-size: 11px; color: var(--danger); min-height: 1px; }

/* Repeat list (phones, emails) */
.repeat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.repeat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.repeat-row select {
  padding: 9px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  width: 92px;
  flex-shrink: 0;
}
.repeat-row select:focus { outline: none; border-color: var(--brand-400); }
.repeat-row input { flex: 1; min-width: 0; }
.repeat-row__remove {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.repeat-row__remove:hover { background: #fef2f2; color: var(--danger); }
.repeat-row__remove .icon { width: 18px; height: 18px; }

/* Tags input */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  min-height: 44px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.tags-input:focus-within {
  background: var(--surface);
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.tags-input__chips { display: contents; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 10px;
  background: var(--brand-100);
  color: var(--brand-700);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}
.tag-chip__x {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--brand-700);
  transition: background var(--transition);
}
.tag-chip__x:hover { background: var(--brand-200); }
.tag-chip__x .icon { width: 14px; height: 14px; }
#tags-field {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  padding: 4px;
  font-size: 13px;
}
#tags-field:focus { outline: none; }

/* Jalali date picker wrapper */
.jdate { display: flex; gap: 8px; align-items: stretch; }
.jdate__input { flex: 1; cursor: pointer; }
.jdate__btn, .jdate__clear {
  width: 44px;
  display: grid; place-items: center;
  background: var(--brand-50);
  color: var(--brand-600);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.jdate__btn:hover { background: var(--brand-100); }
.jdate__clear { background: #fee2e2; color: var(--danger); }
.jdate__clear:hover { background: #fecaca; }

/* ============================================================
   DATE PICKER (calendar)
   ============================================================ */
.datepicker {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  width: 296px;
  animation: modalIn 180ms cubic-bezier(.16,.84,.44,1);
}
.datepicker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.datepicker__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.datepicker__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.datepicker__weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  padding: 6px 0;
}
.datepicker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}
.dp-day:hover:not(.dp-day--disabled) { background: var(--brand-50); color: var(--brand-700); }
.dp-day--other { color: var(--text-3); opacity: .45; }
.dp-day--today { font-weight: 700; color: var(--brand-600); }
.dp-day--selected { background: var(--brand-600) !important; color: #fff !important; font-weight: 700; }
.dp-day--selected:hover { background: var(--brand-700) !important; }
.datepicker__foot {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-body { display: flex; flex-direction: column; gap: 4px; }
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-row__icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.detail-row__icon .icon { width: 18px; height: 18px; }
.detail-row__body { flex: 1; min-width: 0; }
.detail-row__label { font-size: 11px; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.detail-row__value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-row__value a { color: var(--brand-600); text-decoration: none; }
.detail-row__value a:hover { text-decoration: underline; }
.detail-row__value .dir-ltr { direction: ltr; }
.detail-row__copy {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
}
.detail-row__copy:hover { background: var(--bg-soft); color: var(--brand-600); }
.detail-row__copy .icon { width: 15px; height: 15px; }

.detail-meta {
  display: flex;
  gap: 18px;
  padding: 12px 0 4px;
  font-size: 11px;
  color: var(--text-3);
}

.detail-foot__spacer { flex: 1; }
#d-star.starred .icon { fill: var(--amber-500); color: var(--amber-500); }

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-art {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fee2e2;
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.confirm-art svg { width: 32px; height: 32px; fill: var(--danger); }
.confirm__title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.confirm__msg { color: var(--text-2); font-size: 13px; line-height: 1.7; margin-bottom: 20px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
.toast--info    { background: var(--brand-600); }
.toast .icon { width: 18px; height: 18px; fill: #fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset-block: 0;
    right: 0;
    width: 280px;
    z-index: 90;
    transform: translateX(100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 14px 18px; }
  .toolbar { padding: 16px 18px 8px; }
  .contacts { padding: 8px 18px 24px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar__actions .primary-btn span,
  .ghost-btn span { display: none; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .modal { padding: 12px; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
