@font-face {
  font-family: "Alexandria";
  src: url("assets/alexandria-arabic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
  font-family: "Alexandria";
  src: url("assets/alexandria-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --navy: #111827;
  --navy-2: #1f2937;
  --teal: #14b8a6;
  --teal-dark: #0f766e;
  --teal-pale: #ccfbf1;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --green: #15803d;
  --green-pale: #dcfce7;
  --amber: #b45309;
  --amber-pale: #fef3c7;
  --red: #b91c1c;
  --red-pale: #fee2e2;
  --blue: #1d4ed8;
  --blue-pale: #dbeafe;
  --shadow: 0 14px 38px rgba(17, 24, 39, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--gray-100); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--navy); background: var(--gray-100); font-family: "Alexandria", Tahoma, Arial, sans-serif; letter-spacing: 0; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view { display: grid; min-height: 100vh; grid-template-columns: minmax(430px, 1.05fr) minmax(430px, .95fr); background: var(--white); }
.login-brand { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 72px); color: var(--white); background: var(--navy); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 43px; height: 43px; place-items: center; color: var(--navy); background: var(--teal); border-radius: 7px; font: 800 1.3rem "Alexandria", sans-serif; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font: 800 1.15rem "Alexandria", sans-serif; }
.brand-lockup div span { margin-top: 2px; color: var(--gray-300); font-size: .72rem; }
.login-message { width: min(100%, 660px); margin: 70px 0; }
.product-kicker { display: inline-block; margin-bottom: 18px; color: var(--teal); font: 700 .72rem "Alexandria", sans-serif; letter-spacing: 0; }
.login-message h1 { margin: 0; font-size: clamp(2.35rem, 4.2vw, 4.5rem); line-height: 1.22; letter-spacing: 0; }
.login-message p { max-width: 610px; margin: 23px 0 0; color: var(--gray-300); font-size: 1.02rem; line-height: 1.95; }
.login-proof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid rgba(255,255,255,.14); }
.login-proof div { padding: 22px 16px 0; border-inline-start: 1px solid rgba(255,255,255,.12); }
.login-proof div:first-child { padding-inline-start: 0; border-inline-start: 0; }
.login-proof strong, .login-proof span { display: block; }
.login-proof strong { color: var(--white); font-size: .8rem; }
.login-proof span { margin-top: 6px; color: #9ca3af; font-size: .68rem; line-height: 1.7; }
.login-panel { display: grid; min-height: 100vh; place-items: center; padding: 36px; }
.login-form { width: min(100%, 430px); }
.mobile-brand { display: none; }
.form-heading { margin-bottom: 28px; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--teal-dark); font-size: .7rem; font-weight: 800; }
.form-heading h2, .modal-header h2 { margin: 0; font-size: 1.65rem; }
.form-heading p { margin: 9px 0 0; color: var(--gray-500); font-size: .82rem; line-height: 1.7; }
.field { display: grid; gap: 8px; margin-bottom: 16px; color: var(--gray-700); font-size: .78rem; font-weight: 700; }
.field input, .field select, .field textarea, .filter-control { width: 100%; color: var(--navy); background: var(--white); border: 1px solid var(--gray-300); border-radius: 7px; outline: 0; transition: .15s ease; }
.field input, .field select, .filter-control { height: 45px; padding: 0 12px; }
.field textarea { min-height: 92px; padding: 11px 12px; line-height: 1.75; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filter-control:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,184,166,.14); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 7px; font-size: .78rem; font-weight: 800; text-decoration: none; }
.button.primary { color: var(--white); background: var(--teal-dark); border-color: var(--teal-dark); }
.button.primary:hover { background: #115e59; }
.button.secondary { color: var(--navy); background: var(--white); border-color: var(--gray-300); }
.button.secondary:hover { background: var(--gray-50); border-color: #9ca3af; }
.button.danger { color: var(--red); background: var(--white); border-color: #fecaca; }
.button.wide { width: 100%; min-height: 47px; margin-top: 4px; }
.button.small { min-height: 34px; padding: 5px 10px; font-size: .7rem; }
.button[disabled] { cursor: wait; opacity: .58; }
.demo-access { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-top: 24px; padding: 13px 14px; color: var(--gray-500); background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 7px; font-size: .68rem; }
.demo-access span { grid-row: 1 / 3; align-self: center; font-weight: 700; }
.demo-access code { direction: ltr; color: var(--gray-700); font: 600 .67rem Consolas, monospace; text-align: left; }
.alert { margin-bottom: 16px; padding: 11px 13px; border-radius: 7px; font-size: .76rem; line-height: 1.6; }
.alert.error { color: #991b1b; background: var(--red-pale); border: 1px solid #fecaca; }

.app-view { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; top: 0; right: 0; display: flex; width: 242px; height: 100vh; flex-direction: column; color: var(--white); background: var(--navy); border-inline-end: 1px solid rgba(255,255,255,.08); }
.sidebar-brand { min-height: 82px; padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.main-nav { display: grid; gap: 4px; padding: 20px 12px; }
.nav-button { display: flex; min-height: 43px; align-items: center; gap: 11px; padding: 9px 12px; color: var(--gray-300); background: transparent; border: 0; border-radius: 6px; font-size: .78rem; font-weight: 700; text-align: right; }
.nav-button:hover { color: var(--white); background: rgba(255,255,255,.07); }
.nav-button.active { color: var(--white); background: var(--teal-dark); }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; color: inherit; border: 1px solid currentColor; border-radius: 6px; font: 800 .65rem Arial, sans-serif; }
.sidebar-user { display: grid; grid-template-columns: 36px minmax(0,1fr) 34px; gap: 9px; align-items: center; margin-top: auto; padding: 16px 14px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; color: var(--navy); background: var(--teal); border-radius: 50%; font-size: .78rem; font-weight: 800; }
.sidebar-user strong, .sidebar-user div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: .72rem; }
.sidebar-user div span { margin-top: 3px; color: #9ca3af; font-size: .62rem; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 1.25rem; }
.icon-button:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.app-content { min-height: 100vh; margin-right: 242px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(20px, 3vw, 42px); background: rgba(249,250,251,.96); border-bottom: 1px solid var(--gray-200); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.workspace-switcher { display: flex; align-items: center; gap: 9px; padding: 0 10px; background: var(--white); border: 1px solid var(--gray-300); border-radius: 7px; }
.workspace-switcher span { color: var(--gray-500); font-size: .66rem; }
.workspace-switcher select { width: min(220px, 24vw); height: 40px; color: var(--navy); background: transparent; border: 0; outline: 0; font-size: .74rem; font-weight: 700; }
.page-content { width: min(100%, 1440px); margin: 0 auto; padding: 28px clamp(18px, 3vw, 42px) 60px; }

.welcome-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding: 20px 22px; color: var(--white); background: var(--navy-2); border-radius: 8px; }
.welcome-strip h2 { margin: 0; font-size: 1.1rem; }
.welcome-strip p { margin: 5px 0 0; color: var(--gray-300); font-size: .74rem; }
.date-chip { flex: 0 0 auto; padding: 9px 12px; color: var(--navy); background: var(--teal); border-radius: 6px; font-size: .72rem; font-weight: 800; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { min-width: 0; min-height: 112px; padding: 18px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 7px; }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--gray-500); font-size: .68rem; }
.metric-mark { display: block; width: 9px; height: 9px; background: var(--teal); border-radius: 2px; }
.metric-mark.green { background: var(--green); }
.metric-mark.amber { background: #f59e0b; }
.metric-mark.blue { background: var(--blue); }
.metric strong { display: block; margin-top: 13px; font-size: 1.65rem; line-height: 1; }
.metric small { display: block; margin-top: 7px; color: var(--gray-500); font-size: .64rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .72fr); gap: 16px; align-items: start; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 5px 18px rgba(17,24,39,.035); }
.panel + .panel { margin-top: 16px; }
.panel-heading { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--gray-200); }
.panel-heading h2 { margin: 0; font-size: .9rem; }
.panel-heading p { margin: 3px 0 0; color: var(--gray-500); font-size: .64rem; }
.panel-body { padding: 16px; }
.visit-list, .schedule-list, .followup-list { display: grid; }
.visit-row { display: grid; grid-template-columns: 58px minmax(170px,1fr) 96px auto; gap: 12px; align-items: center; min-height: 76px; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); }
.visit-row.with-employee { grid-template-columns: 58px minmax(170px,1fr) minmax(120px,.7fr) 96px auto; }
.visit-row:last-child { border-bottom: 0; }
.time-block { color: var(--navy); font: 800 .78rem "Alexandria", sans-serif; text-align: center; }
.time-block span { display: block; margin-top: 4px; color: var(--gray-500); font: 500 .58rem "Alexandria", sans-serif; }
.client-cell { min-width: 0; }
.client-cell strong, .client-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-cell strong { font-size: .76rem; }
.client-cell span { margin-top: 5px; color: var(--gray-500); font-size: .64rem; }
.client-cell .doctor-hours { display: block; margin-top: 5px; overflow: hidden; color: var(--teal-dark); font-size: .58rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.employee-cell { display: flex; min-width: 0; align-items: center; gap: 7px; color: var(--gray-700); font-size: .68rem; }
.mini-avatar { display: grid; flex: 0 0 29px; width: 29px; height: 29px; place-items: center; color: var(--teal-dark); background: var(--teal-pale); border-radius: 50%; font-size: .65rem; font-weight: 800; }
.status { display: inline-flex; min-height: 27px; align-items: center; justify-content: center; padding: 4px 8px; border-radius: 5px; font-size: .62rem; font-weight: 800; white-space: nowrap; }
.status.planned { color: var(--blue); background: var(--blue-pale); }
.status.in-progress { color: #075985; background: #e0f2fe; }
.status.completed, .status.interested { color: var(--green); background: var(--green-pale); }
.status.follow_up, .status.demo { color: var(--amber); background: var(--amber-pale); }
.status.not_now, .status.missed { color: var(--red); background: var(--red-pale); }
.status.active { color: var(--teal-dark); background: var(--teal-pale); }
.status.inactive { color: var(--gray-500); background: var(--gray-100); }
.status.client-new { color: var(--blue); background: var(--blue-pale); }
.status.client-interested, .status.client-won { color: var(--green); background: var(--green-pale); }
.status.client-proposal, .status.client-follow_up { color: var(--amber); background: var(--amber-pale); }
.status.client-not_fit { color: var(--red); background: var(--red-pale); }
.visit-finish-meta { display: grid; gap: 4px; justify-items: start; }
.visit-finish-meta small { color: var(--gray-500); font-size: .56rem; }
.visit-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 6px; }
.directions-link { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; padding: 5px 9px; color: var(--teal-dark); background: var(--teal-pale); border: 1px solid #99f6e4; border-radius: 6px; font-size: .62rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.directions-link:hover { background: #99f6e4; }
.progress-block { display: grid; gap: 12px; }
.progress-line { display: grid; gap: 7px; }
.progress-line div:first-child { display: flex; justify-content: space-between; color: var(--gray-700); font-size: .68rem; }
.progress-track { overflow: hidden; height: 7px; background: var(--gray-100); border-radius: 3px; }
.progress-fill { height: 100%; background: var(--teal-dark); }
.followup-item { display: grid; grid-template-columns: 41px minmax(0,1fr); gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--gray-200); }
.followup-item:last-child { border-bottom: 0; }
.followup-date { display: grid; height: 41px; place-items: center; color: var(--teal-dark); background: var(--teal-pale); border-radius: 6px; font-size: .63rem; font-weight: 800; text-align: center; }
.followup-item strong, .followup-item span { display: block; }
.followup-item strong { font-size: .7rem; }
.followup-item span { margin-top: 4px; color: var(--gray-500); font-size: .61rem; }

.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-toolbar .toolbar-filters, .toolbar-actions { display: flex; align-items: center; gap: 8px; }
.filter-control { width: auto; min-width: 155px; }
.data-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: .63rem; font-weight: 700; text-align: right; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--gray-200); font-size: .7rem; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td strong { font-size: .73rem; }
td small { margin-top: 4px; color: var(--gray-500); font-size: .6rem; }
.table-actions { display: flex; align-items: center; gap: 6px; }
.icon-action { min-height: 30px; padding: 4px 8px; color: var(--teal-dark); background: var(--white); border: 1px solid var(--gray-300); border-radius: 5px; font-size: .6rem; font-weight: 700; }
.icon-action:hover { background: var(--teal-pale); border-color: #5eead4; }
.icon-action.danger { color: var(--red); }
.icon-action.danger:hover { background: var(--red-pale); border-color: #fecaca; }
.location-link { color: var(--teal-dark); font-size: .66rem; font-weight: 700; text-decoration: none; }
.location-link:hover { text-decoration: underline; }
.empty-state { padding: 48px 20px; color: var(--gray-500); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--navy); font-size: .86rem; }
.empty-state span { margin-top: 7px; font-size: .68rem; }
.employee-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.employee-card { padding: 17px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 7px; }
.employee-card.suspended { background: var(--gray-50); border-color: var(--gray-300); }
.employee-card-head { display: flex; align-items: center; gap: 10px; }
.employee-card-head .avatar { flex: 0 0 40px; width: 40px; height: 40px; }
.employee-card-head div { min-width: 0; }
.employee-card-head > .status { margin-inline-start: auto; }
.employee-card-head strong, .employee-card-head span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.employee-card-head strong { font-size: .78rem; }
.employee-card-head span { margin-top: 4px; color: var(--gray-500); font-size: .62rem; direction: ltr; text-align: right; }
.employee-card-head em { display: block; margin-top: 5px; color: var(--teal-dark); font-size: .58rem; font-style: normal; font-weight: 700; }
.employee-stats { display: grid; grid-template-columns: repeat(3,1fr); margin: 16px 0; padding: 12px 0; border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); }
.employee-stats div { text-align: center; border-inline-start: 1px solid var(--gray-200); }
.employee-stats div:first-child { border-inline-start: 0; }
.employee-stats strong, .employee-stats span { display: block; }
.employee-stats strong { font-size: 1rem; }
.employee-stats span { margin-top: 3px; color: var(--gray-500); font-size: .56rem; }
.employee-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.employee-actions { display: flex; gap: 5px; }
.employee-actions { flex-wrap: wrap; justify-content: flex-end; }
.platform-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; padding: 4px 7px; color: var(--gray-700); background: var(--gray-100); border-radius: 4px; font-size: .57rem; }
.report-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.summary-tile { padding: 14px; background: var(--white); border: 1px solid var(--gray-200); border-inline-start: 3px solid var(--teal); border-radius: 6px; }
.summary-tile strong, .summary-tile span { display: block; }
.summary-tile strong { font-size: 1.25rem; }
.summary-tile span { margin-top: 5px; color: var(--gray-500); font-size: .62rem; }
.report-visit { display: grid; grid-template-columns: 85px minmax(150px,1fr) minmax(150px,1fr) minmax(170px,1.2fr) 90px; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--gray-200); }
.report-visit:last-child { border-bottom: 0; }
.report-visit > div strong, .report-visit > div span { display: block; }
.report-visit > div strong { font-size: .7rem; }
.report-visit > div span { margin-top: 5px; color: var(--gray-500); font-size: .61rem; line-height: 1.6; }
.report-edit { margin-top: 8px; }
.visit-photos { display: flex !important; gap: 6px; margin-top: 9px; }
.photo-thumb { overflow: hidden; width: 46px; height: 46px; padding: 0; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 5px; }
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.client-status-select { min-width: 100px; height: 34px; padding: 0 8px; color: var(--navy); background: var(--white); border: 1px solid var(--gray-300); border-radius: 6px; font-size: .64rem; font-weight: 700; }
.availability-cell { display: block; min-width: 150px; color: var(--gray-700); font-size: .62rem; line-height: 1.7; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; padding: 20px; place-items: center; background: rgba(17,24,39,.58); }
.modal { overflow: hidden; width: min(100%, 700px); max-height: calc(100vh - 40px); background: var(--white); border-radius: 8px; box-shadow: 0 24px 70px rgba(17,24,39,.28); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-header h2 { font-size: 1.05rem; }
.modal-header .icon-button { color: var(--gray-500); border-color: var(--gray-200); }
.modal-header .icon-button:hover { color: var(--navy); background: var(--gray-100); }
.modal-body { overflow-y: auto; max-height: calc(100vh - 118px); padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 13px; }
.field.full, .form-actions, .location-capture, .photo-capture, .visit-start-note, .availability-days { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.location-capture { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 12px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 7px; }
.location-capture strong, .location-capture span { display: block; }
.location-capture strong { font-size: .7rem; }
.location-capture span { margin-top: 4px; color: var(--gray-500); font-size: .6rem; }
.photo-capture { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; margin-bottom: 16px; padding: 13px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 7px; }
.photo-capture strong, .photo-capture > div > span { display: block; }
.photo-capture strong { font-size: .72rem; }
.photo-capture > div > span { margin-top: 5px; color: var(--gray-500); font-size: .6rem; line-height: 1.6; }
.photo-preview { display: flex !important; grid-column: 1 / -1; gap: 7px; min-height: 0; }
.photo-preview:empty { display: none !important; }
.photo-preview span { overflow: hidden; width: 66px; height: 66px; border: 1px solid var(--gray-200); border-radius: 6px; }
.photo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.visit-start-note { margin-bottom: 13px; padding: 12px; color: var(--navy); background: var(--blue-pale); border: 1px solid #bfdbfe; border-radius: 7px; }
.visit-start-note strong, .visit-start-note span { display: block; }
.visit-start-note strong { font-size: .72rem; }
.visit-start-note span { margin-top: 5px; color: var(--gray-700); font-size: .62rem; line-height: 1.6; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-bottom: 16px; }
.section-label { margin-bottom: 8px; }
.permission-heading { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 12px; margin: 5px 0 10px; padding-top: 15px; border-top: 1px solid var(--gray-200); }
.permission-heading strong, .permission-heading span { display: block; }
.permission-heading strong { font-size: .76rem; }
.permission-heading span { margin-top: 4px; color: var(--gray-500); font-size: .6rem; line-height: 1.6; }
.permissions-grid { grid-column: 1 / -1; }
.check-option { position: relative; display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 8px 10px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; font-size: .7rem; font-weight: 700; }
.check-option input { width: 16px; height: 16px; accent-color: var(--teal-dark); }
.time-range { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 7px; align-items: center; }
.time-range span { color: var(--gray-500); font-size: .62rem; }
.availability-days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 6px; margin: -8px 0 16px; }
.day-option { position: relative; }
.day-option input { position: absolute; opacity: 0; pointer-events: none; }
.day-option span { display: grid; min-height: 38px; place-items: center; padding: 5px; color: var(--gray-700); background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; font-size: .58rem; font-weight: 700; text-align: center; }
.day-option input:checked + span { color: var(--teal-dark); background: var(--teal-pale); border-color: #5eead4; }
.client-profile { display: grid; gap: 15px; }
.profile-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.profile-facts > div { min-width: 0; padding: 12px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; }
.profile-facts span, .profile-facts strong { display: block; }
.profile-facts > div > span { color: var(--gray-500); font-size: .57rem; }
.profile-facts strong { margin-top: 6px; overflow-wrap: anywhere; font-size: .68rem; }
.availability-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; color: var(--white); background: var(--navy-2); border-radius: 7px; }
.availability-panel span, .availability-panel strong, .availability-panel small { display: block; }
.availability-panel span { color: var(--teal); font-size: .6rem; }
.availability-panel strong { margin-top: 6px; font-size: .78rem; }
.availability-panel small { margin-top: 6px; color: var(--gray-300); font-size: .58rem; line-height: 1.6; }
.profile-section { padding: 14px; border: 1px solid var(--gray-200); border-radius: 7px; }
.profile-section h3 { margin: 0 0 9px; font-size: .75rem; }
.profile-section p { margin: 5px 0; color: var(--gray-500); font-size: .64rem; line-height: 1.7; }
.profile-visit { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-200); font-size: .63rem; }
.profile-visit:last-child { border-bottom: 0; }
.toast { position: fixed; z-index: 160; right: 50%; bottom: 22px; min-width: 240px; max-width: calc(100vw - 24px); padding: 11px 16px; color: var(--white); background: var(--navy); border-radius: 7px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(50%, 12px); transition: .18s ease; font-size: .73rem; text-align: center; }
.toast.show { opacity: 1; transform: translate(50%, 0); }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .employee-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .visit-row, .visit-row.with-employee { grid-template-columns: 54px minmax(160px,1fr) 90px auto; }
  .employee-cell { display: none; }
  .report-visit { grid-template-columns: 75px minmax(140px,1fr) minmax(150px,1fr); }
  .report-visit > div:nth-child(4), .report-visit > div:nth-child(5) { grid-column: span 1; }
}

@media (max-width: 820px) {
  .login-view { grid-template-columns: 1fr; background: var(--gray-50); }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 24px 16px; }
  .login-form { padding: 25px 20px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: var(--shadow); }
  .mobile-brand { display: flex; margin-bottom: 38px; }
  .mobile-brand div span { color: var(--gray-500); }
  .sidebar { top: auto; bottom: 0; width: 100%; height: 66px; border-top: 1px solid rgba(255,255,255,.12); }
  .sidebar-brand, .sidebar-user { display: none; }
  .main-nav { display: flex; height: 100%; justify-content: space-around; gap: 2px; padding: 7px; }
  .nav-button { min-width: 58px; min-height: 50px; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 7px; font-size: .55rem; text-align: center; }
  .nav-icon { width: 20px; height: 20px; border: 0; font-size: .6rem; }
  .app-content { margin-right: 0; padding-bottom: 66px; }
  .topbar { position: static; align-items: flex-start; flex-direction: column; padding: 15px 14px; }
  .topbar-actions { width: 100%; }
  .workspace-switcher { min-width: 0; flex: 1; }
  .workspace-switcher span { display: none; }
  .workspace-switcher select { width: 100%; }
  .topbar-actions .button { flex: 0 0 auto; }
  .page-content { padding: 18px 12px 36px; }
  .welcome-strip { align-items: flex-start; padding: 17px; }
  .welcome-strip h2 { font-size: .95rem; }
  .welcome-strip p { line-height: 1.7; }
  .date-chip { font-size: .62rem; }
  .employee-grid { grid-template-columns: 1fr; }
  .page-toolbar { align-items: stretch; flex-direction: column; }
  .page-toolbar .toolbar-filters, .toolbar-actions { width: 100%; }
  .filter-control { min-width: 0; width: 100%; }
  .toolbar-actions .button { flex: 1; }
  .report-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-visit { grid-template-columns: 70px minmax(0,1fr); }
  .report-visit > div:nth-child(n+3) { grid-column: 1 / -1; }
  .availability-days { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .profile-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .metrics-grid { gap: 8px; }
  .metric { min-height: 100px; padding: 14px; }
  .metric strong { font-size: 1.38rem; }
  .visit-row, .visit-row.with-employee { grid-template-columns: 48px minmax(0,1fr) auto; gap: 8px; min-height: 72px; padding: 11px; }
  .visit-row .button { grid-column: 2 / -1; justify-self: start; }
  .visit-row .visit-actions { grid-column: 2 / -1; }
  .panel-heading { padding: 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-actions, .location-capture, .photo-capture, .visit-start-note, .availability-days { grid-column: auto; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal { width: 100%; max-height: 94vh; border-radius: 8px 8px 0 0; }
  .modal-body { max-height: calc(94vh - 72px); padding: 17px 14px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .availability-days { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .availability-panel { align-items: stretch; flex-direction: column; }
  .demo-access { grid-template-columns: 1fr; }
  .demo-access span { grid-row: auto; }
  .demo-access code { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
