/* ============================================================
   HARLEY HEALTH PORTAL — MAIN STYLESHEET
   v1.0 — April 2026
   Static HTML prototype. PHP developer: replace shared
   sections with <?php include 'partials/sidebar.php' ?> etc.
   ============================================================ */

/* ---- Fonts ---- */
@font-face {
  font-family: 'ABC Diatype';
  font-weight: 300;
  font-display: swap;
  src: url('../assets/Font/ABCDiatype-Light-Trial.woff2') format('woff2');
}
@font-face {
  font-family: 'ABC Diatype';
  font-weight: 400;
  font-display: swap;
  src: url('../assets/Font/ABCDiatype-Regular-Trial.woff2') format('woff2');
}
@font-face {
  font-family: 'ABC Diatype';
  font-weight: 500;
  font-display: swap;
  src: url('../assets/Font/ABCDiatype-Medium-Trial.woff2') format('woff2');
}
@font-face {
  font-family: 'ABC Diatype';
  font-weight: 700;
  font-display: swap;
  src: url('../assets/Font/ABCDiatype-Bold-Trial.woff2') format('woff2');
}

/* ---- Design Tokens ---- */
:root {
  /* Brand */
  --green-900:  #143F3D;
  --green-800:  #1B514D;
  --green-700:  #236763;
  --green-600:  #0F7B74;
  --green-100:  #DCEEEB;
  --green-50:   #F2F8F7;

  --red-500:    #E53333;
  --red-600:    #CC2020;

  /* Accent colors for icon backgrounds */
  --blue-50:    #E0F2F7;
  --blue-600:   #0E7DB9;
  --amber-50:   #FFF4E0;
  --amber-600:  #D97706;

  /* Neutrals */
  --text-900:   #1A1A1A;
  --text-700:   #363636;
  --text-500:   #666666;
  --text-300:   #9E9E9E;

  --border-200: #EBEBEB;
  --border-300: #D8D8D8;

  --bg-50:      #FAFAFA;
  --bg-100:     #F5F5F5;
  --white:      #FFFFFF;

  /* Typography */
  --font: 'ABC Diatype', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --sidebar-w:  240px;

  /* Radii */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);

  /* Motion */
  --ease: 150ms ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text-700); background: var(--bg-50); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ---- Typography Scale ---- */
h1 { font-size: 28px; font-weight: 500; color: var(--text-900); line-height: 1.2; letter-spacing: -0.025em; }
h2 { font-size: 22px; font-weight: 500; color: var(--text-900); line-height: 1.25; letter-spacing: -0.015em; }
h3 { font-size: 17px; font-weight: 500; color: var(--text-900); line-height: 1.35; letter-spacing: -0.01em; }
h4 { font-size: 15px; font-weight: 500; color: var(--text-900); line-height: 1.4; }
p  { font-size: 14px; line-height: 1.6; color: var(--text-700); }
small { font-size: 12px; line-height: 1.5; }


/* ================================================================
   PORTAL LAYOUT (sidebar + content)
   ================================================================ */

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: center;
}
.sidebar-logo a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}
.sidebar-logo-img { height: 80px; width: auto; flex-shrink: 0; }

.sidebar-nav { flex: 1; padding: 10px 0; }

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.60);
  font-size: 14px;
  font-weight: 400;
  transition: background var(--ease), color var(--ease);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.sidebar-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.88);
}
.sidebar-nav-item.active {
  background: rgba(89, 141, 136, 0.34);
  color: var(--white);
  font-weight: 500;
  border-left-color: rgba(214, 239, 235, 0.7);
}
.sidebar-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease);
}
.sidebar-user:hover {
  background: rgba(255,255,255,0.05);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--green-900);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--white);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 500; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.45); }

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: auto;
}

.page-header {
  padding: 36px 40px 0;
  border-bottom: 1px solid var(--border-200);
  padding-bottom: 24px;
  background: var(--white);
  min-width: 0;
}
.page-title   { font-size: 24px; }
.page-subtitle { font-size: 13px; color: var(--text-500); margin-top: 3px; }

.page-body { padding: 32px 40px 60px; min-width: 0; }


/* ================================================================
   COMPONENTS
   ================================================================ */

/* ---- Card ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border-200);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-300);
  margin-bottom: 8px;
}

/* ---- Treatment Banner ---- */
.treatment-banner {
  background: var(--white);
  border: 1px solid var(--border-200);
  border-left: 4px solid var(--green-900);
  border-radius: var(--r-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.treatment-banner-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--green-900); margin-bottom: 5px;
}
.treatment-banner-title { font-size: 17px; font-weight: 500; color: var(--text-900); }
.treatment-banner-meta  { font-size: 13px; color: var(--text-500); margin-top: 4px; }
.treatment-banner-link  {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: rgba(255,255,255,0.75);
  white-space: nowrap; flex-shrink: 0;
  transition: color var(--ease);
}
.treatment-banner-link:hover { color: var(--white); }
.treatment-banner-link svg { width: 14px; height: 14px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  transition: all var(--ease);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary { background: var(--red-500); color: var(--white); }
.btn-primary:hover { background: var(--red-600); }
.btn-green { background: var(--green-900); color: var(--white); }
.btn-green:hover { background: var(--green-800); }
.btn-secondary {
  background: transparent;
  color: var(--text-700);
  border: 1px solid var(--border-300);
}
.btn-secondary:hover { background: var(--bg-100); }
.btn-ghost { background: transparent; color: var(--red-500); padding-left: 0; padding-right: 0; }
.btn-ghost:hover { color: var(--red-600); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-700); margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-300);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-900);
  background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--green-900);
  box-shadow: 0 0 0 3px rgba(11,61,42,0.08);
}
.form-input::placeholder { color: var(--text-300); }
.form-input:read-only { background: var(--bg-50); color: var(--text-500); cursor: default; }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 42px; }
.input-suffix {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  cursor: pointer; color: var(--text-300);
  display: flex; align-items: center;
  transition: color var(--ease);
}
.input-suffix:hover { color: var(--text-700); }
.input-suffix svg { width: 17px; height: 17px; }

.form-hint { font-size: 12px; color: var(--text-500); margin-top: 6px; line-height: 1.5; }
.form-error { font-size: 12px; color: var(--red-500); margin-top: 5px; display: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Tabs ---- */
.tabs {
  display: inline-flex;
  background: var(--bg-100);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  margin-bottom: 24px;
}
.tab-btn {
  padding: 9px 22px;
  font-size: 14px; font-weight: 400;
  color: var(--text-500);
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-700); }
.tab-btn.active {
  background: var(--white);
  color: var(--text-900);
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Accordion ---- */
.accordion {
  background: var(--white);
  border: 1px solid var(--border-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 10px;
}
.accordion-trigger {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  font-size: 15px; font-weight: 500; color: var(--text-900);
  background: var(--white); cursor: pointer;
  text-align: left; border: none;
  font-family: var(--font);
  transition: background var(--ease);
}
.accordion-trigger:hover { background: var(--bg-50); }
.accordion-trigger[aria-expanded="true"] { background: var(--bg-50); }
.accordion-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--text-300);
  transition: transform var(--ease), color var(--ease);
}
.accordion-trigger[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg); color: var(--green-900);
}
.accordion-body {
  display: none;
  border-top: 1px solid var(--border-200);
}
.accordion-body.open { display: block; }
.accordion-content {
  padding: 20px 24px 24px;
  font-size: 14px; color: var(--text-700); line-height: 1.7;
}
.accordion-content h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-500); font-weight: 500; }
.accordion-content h4:first-child { margin-top: 0; }
.accordion-content p + p { margin-top: 10px; }
.accordion-content ul { padding-left: 18px; list-style: disc; margin: 10px 0; }
.accordion-content li { margin-bottom: 5px; }

/* ---- Badge ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
}
.badge-active   { background: var(--green-100); color: var(--green-800); }
.badge-pending  { background: #FFF3E0; color: #E65100; }
.badge-inactive { background: var(--bg-100); color: var(--text-500); }

/* ---- Divider ---- */
.divider { height: 1px; background: var(--border-200); margin: 24px 0; }

/* ---- Info row ---- */
.info-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; font-size: 14px; }
.info-label { color: var(--text-300); min-width: 110px; font-size: 13px; }
.info-value { color: var(--text-700); font-weight: 400; }


/* ================================================================
   STANDALONE PAGES (login, forgot password, pending)
   ================================================================ */

.standalone-page {
  min-height: 100vh;
  background: var(--bg-50);
  display: flex;
  flex-direction: column;
}
.standalone-nav {
  padding: 24px 40px;
  border-bottom: 1px solid var(--border-200);
  background: var(--white);
}
.standalone-logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-900);
}
.standalone-logo-img { height: 26px; width: auto; }

.standalone-body {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px;
}
.standalone-box { width: 100%; max-width: 420px; }
.standalone-box-title {
  font-size: 26px; font-weight: 500;
  color: var(--text-900); letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.standalone-box-subtitle {
  font-size: 14px; color: var(--text-500);
  margin-bottom: 32px; line-height: 1.6;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-500);
  margin-bottom: 28px;
  transition: color var(--ease);
}
.back-link:hover { color: var(--text-900); }
.back-link svg { width: 15px; height: 15px; }

/* ---- Pending state ---- */
.pending-icon {
  width: 64px; height: 64px;
  background: var(--green-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}
.pending-icon svg { width: 28px; height: 28px; color: var(--green-900); }
.steps-list { margin-top: 24px; }
.step-item {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-200);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green-900); color: var(--white);
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.step-text { font-size: 14px; color: var(--text-700); line-height: 1.5; }
.step-text strong { color: var(--text-900); font-weight: 500; }


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

.mobile-bar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--green-900);
  position: sticky; top: 0; z-index: 200;
}
.mobile-bar-logo { display: flex; align-items: center; }
.mobile-bar-logo .sidebar-logo-img { height: 20px; }
.mobile-menu-btn { color: var(--white); padding: 4px; display: flex; }
.mobile-menu-btn svg { width: 22px; height: 22px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 99;
}
.sidebar-overlay.open { display: block; }

.mobile-bottom-nav {
  display: none;
}

/* ================================================================
   ADMIN — COMPONENTS
   ================================================================ */

/* ---- Sidebar nav badge ---- */
.sidebar-nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-size: 10px; font-weight: 500;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; flex-shrink: 0;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-300);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-500); transition: color var(--ease); }
.breadcrumb a:hover { color: var(--text-900); }
.breadcrumb svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ---- Stat cards ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border-200);
  border-radius: var(--r-lg);
  padding: 22px 24px;
}
.stat-card-label {
  font-size: 11px; font-weight: 500;
  color: var(--text-300);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.stat-card-value {
  font-size: 36px; font-weight: 500;
  color: var(--text-900);
  letter-spacing: -0.03em; line-height: 1;
  margin-bottom: 6px;
}
.stat-card-sub { font-size: 12px; color: var(--text-300); }
.stat-card-sub.positive { color: var(--green-700); }

/* ---- Table wrap ---- */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.table-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-200);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.table-toolbar-title { font-size: 14px; font-weight: 500; color: var(--text-900); flex: 1; }
.table-footer { padding: 12px 20px; border-top: 1px solid var(--border-200); }
.table-footer a {
  font-size: 13px; color: var(--green-900); font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  transition: opacity var(--ease);
}
.table-footer a:hover { opacity: 0.7; }
.table-footer a svg { width: 13px; height: 13px; }

/* ---- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 9px 20px; text-align: left;
  font-size: 11px; font-weight: 500; color: var(--text-300);
  text-transform: uppercase; letter-spacing: 0.07em;
  background: var(--bg-50); border-bottom: 1px solid var(--border-200);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 20px; font-size: 14px; color: var(--text-700);
  border-bottom: 1px solid var(--border-200); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--ease); cursor: pointer; }
.data-table tbody tr:hover { background: var(--bg-50); }
.td-primary { font-weight: 500; color: var(--text-900); }
.td-muted { font-size: 12px; color: var(--text-300); margin-top: 2px; }
.td-right { text-align: right; white-space: nowrap; }

/* ---- Search input ---- */
.search-wrap { position: relative; flex-shrink: 0; }
.search-wrap > svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-300); pointer-events: none;
}
.search-input {
  padding: 8px 14px 8px 34px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--border-300); border-radius: var(--r-md);
  background: var(--white); color: var(--text-900);
  width: 220px; outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.search-input:focus {
  border-color: var(--green-900);
  box-shadow: 0 0 0 3px rgba(11,61,42,0.06);
}
.search-input::placeholder { color: var(--text-300); }

/* ---- Filter tabs ---- */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 6px 12px; font-size: 13px; font-family: var(--font);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text-500);
  cursor: pointer; transition: all var(--ease); white-space: nowrap;
}
.filter-tab:hover { background: var(--bg-100); color: var(--text-700); }
.filter-tab.active { background: var(--green-900); color: var(--white); }
.filter-tab-count { font-size: 11px; opacity: 0.6; margin-left: 3px; }

/* ---- Badge variants (admin) ---- */
.badge-reviewed { background: #EEF4FF; color: #2F5EC4; }

/* ---- Form select ---- */
.form-select {
  width: 100%; padding: 11px 36px 11px 14px;
  border: 1px solid var(--border-300); border-radius: var(--r-md);
  font-size: 14px; font-family: var(--font);
  color: var(--text-900); background: var(--white);
  outline: none; transition: border-color var(--ease);
  -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%239E9E9E' stroke-width='1.5'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.form-select:focus { border-color: var(--green-900); box-shadow: 0 0 0 3px rgba(11,61,42,0.06); }

/* ---- Page header with action button ---- */
.page-header-inner {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 16px;
}

/* ---- Client header (detail page) ---- */
.client-header {
  background: var(--white); border: 1px solid var(--border-200);
  border-radius: var(--r-lg); padding: 24px;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 20px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.client-header-left { display: flex; align-items: center; gap: 16px; }
.client-avatar-lg {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--green-100); color: var(--green-900);
  font-size: 17px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.client-name-row {
  font-size: 19px; font-weight: 500; color: var(--text-900);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.client-meta { display: flex; gap: 18px; flex-wrap: wrap; }
.client-meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text-500);
}
.client-meta-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.client-header-actions { display: flex; gap: 8px; align-items: flex-start; flex-shrink: 0; }

/* ---- Notes ---- */
.note-add textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border-300); border-radius: var(--r-md);
  font-size: 14px; font-family: var(--font); color: var(--text-900);
  resize: vertical; min-height: 80px; outline: none;
  transition: border-color var(--ease); margin-bottom: 10px;
}
.note-add textarea:focus { border-color: var(--green-900); box-shadow: 0 0 0 3px rgba(11,61,42,0.06); }
.note-add textarea::placeholder { color: var(--text-300); }
.note-item { padding: 16px 0; border-bottom: 1px solid var(--border-200); }
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 12px; color: var(--text-300); margin-bottom: 6px; }
.note-text { font-size: 14px; color: var(--text-700); line-height: 1.6; }

/* ================================================================
   DRAWER / SLIDE-IN MODAL
   ================================================================ */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.drawer {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 100%;
  max-width: 33.33vw;
  background: var(--white);
  z-index: 301;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.08, 0.64, 1);
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
}
.drawer.open {
  display: flex;
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px 34px;
  border-bottom: 1px solid var(--border-200);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title {
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--text-900);
}
.drawer-close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid #dde5e3;
  background: var(--white);
  color: var(--green-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  flex-shrink: 0;
}
.drawer-close:hover {
  background: #f8fbfa;
  border-color: #cfdcda;
  color: var(--green-800);
}
.drawer-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-200);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  justify-content: space-between;
}

/* ---- Drawer sections (for admin pages) ---- */
.drawer-section {
  margin-bottom: 20px;
}
.drawer-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-300);
  margin-bottom: 8px;
}
.drawer-value {
  font-size: 14px;
  color: var(--text-900);
  font-weight: 500;
}

/* ---- Collapsible sections ---- */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 0;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-900);
  cursor: pointer;
  text-align: left;
  transition: color var(--ease);
}
.collapsible-header:hover {
  color: var(--green-900);
}
.collapsible-header svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.collapsible-content {
  max-height: 500px;
  overflow: hidden;
  transition: all 0.2s ease;
}

/* ---- Form section ---- */
.form-section {
  margin-bottom: 24px;
}
.form-section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-900);
  margin-bottom: 12px;
}

/* ---- Neutral gray background ---- */
.gray-50 {
  background: #F9F9F9;
}

@media (max-width: 768px) {
  .drawer {
    max-width: 100%;
  }
  .drawer-footer {
    flex-direction: column;
  }
  .drawer-footer > div {
    display: flex;
    gap: 8px;
    width: 100%;
  }
}

/* ---- Protocol — assigned (client detail) ---- */
.protocol-assigned {
  background: var(--white); border: 1px solid var(--border-200);
  border-radius: var(--r-lg); padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 10px;
}
.protocol-assigned-name { font-size: 15px; font-weight: 500; color: var(--text-900); margin-bottom: 3px; }
.protocol-assigned-meta { font-size: 13px; color: var(--text-500); }
.protocol-assigned-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- Protocol library card ---- */
.protocol-lib-card {
  background: var(--white); border: 1px solid var(--border-200);
  border-radius: var(--r-lg); padding: 20px 24px;
  display: flex; align-items: center; gap: 18px; margin-bottom: 10px;
}
.protocol-lib-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--green-50);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.protocol-lib-icon svg { width: 20px; height: 20px; color: var(--green-900); }
.protocol-lib-info { flex: 1; min-width: 0; }
.protocol-lib-name { font-size: 15px; font-weight: 500; color: var(--text-900); margin-bottom: 3px; }
.protocol-lib-meta { font-size: 13px; color: var(--text-500); }
.protocol-lib-shopify {
  font-size: 12px; color: var(--text-300); margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.protocol-lib-shopify svg { width: 12px; height: 12px; }
.protocol-lib-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- File items ---- */
.files-section { margin-bottom: 28px; }
.files-section-title {
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-300); margin-bottom: 12px;
}
.file-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border-200);
}
.file-item:last-child { border-bottom: none; }
.file-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--bg-100);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-icon svg { width: 17px; height: 17px; color: var(--text-500); }
.file-name { font-size: 14px; color: var(--text-900); font-weight: 500; margin-bottom: 2px; }
.file-meta { font-size: 12px; color: var(--text-300); }
.file-actions { margin-left: auto; flex-shrink: 0; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 900; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white); border-radius: var(--r-xl);
  padding: 32px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: wCardIn 0.25s cubic-bezier(0.34,1.08,0.64,1) both;
}
.modal-title { font-size: 18px; font-weight: 500; color: var(--text-900); margin-bottom: 6px; }
.modal-sub { font-size: 14px; color: var(--text-500); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ---- Admin responsive ---- */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr; }
  .client-header { flex-direction: column; }
  .client-meta { gap: 10px; }
  .search-input { width: 100%; }
  .table-toolbar { gap: 8px; }
  .page-header-inner { flex-direction: column; align-items: flex-start; }
  .protocol-lib-card { flex-wrap: wrap; }
}


/* ================================================================
   EXISTING RESPONSIVE
   ================================================================ */

@media (max-width: 1100px) {
  .portal-layout {
    display: block;
  }
  .sidebar {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
  }
  .mobile-bar { display: flex; }
  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }
  .page-header { padding: 24px 20px 18px; }
  .page-body   { padding: 22px 20px 94px; }
  .treatment-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .standalone-nav { padding: 20px; }
  .standalone-body { padding: 40px 20px; }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 205;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(11,63,58,0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -10px 28px rgba(0,0,0,0.12);
    min-height: calc(76px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 56px;
    padding: 8px 4px;
    border-radius: 16px;
    color: rgba(255,255,255,0.72);
    transition: background var(--ease), color var(--ease), transform var(--ease);
  }
  .mobile-bottom-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
  }
  .mobile-bottom-nav-item span {
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
  }
  .mobile-bottom-nav-item.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
  }
  .mobile-bottom-nav-item:active {
    transform: scale(0.98);
  }
  .mobile-menu-btn,
  .sidebar-overlay {
    display: none !important;
  }
  .main-content::after {
    content: '';
    display: block;
    height: calc(96px + env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .mobile-bar {
    padding: 12px 16px;
    justify-content: center;
  }
  .mobile-bar-logo .sidebar-logo-img {
    height: 24px;
  }
  .mobile-menu-btn {
    position: absolute;
    right: 16px;
  }
  .page-header {
    padding: 20px 16px 16px;
  }
  .page-body {
    padding: 18px 16px 36px;
  }
  .page-body {
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }
  .sidebar-nav-item {
    padding: 12px 22px;
    font-size: 15px;
  }
  .sidebar-user {
    padding: 14px 18px;
  }
  .sidebar-user-avatar {
    width: 30px;
    height: 30px;
  }
  .drawer-header,
  .drawer-body,
  .drawer-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .mobile-bottom-nav {
    padding-left: 8px;
    padding-right: 8px;
  }
  .mobile-bottom-nav-item {
    min-height: 54px;
    border-radius: 14px;
  }
  .mobile-bottom-nav-item span {
    font-size: 10px;
  }
  .main-content::after {
    height: calc(108px + env(safe-area-inset-bottom));
  }
}
