/* ── LovedOnes Desktop App Styles ── */
:root {
  --primary: #007EA7;
  --primary-dark: #005F80;
  --primary-light: #E8F4FD;
  --bg-start: #F2F8FF;
  --bg-end: #D9E4F1;
  --text-primary: #1F2A3D;
  --text-secondary: #666E7C;
  --text-tertiary: #8E8E93;
  --border: #D2E2FD;
  --border-light: #E8ECF0;
  --white: #FFFFFF;
  --red: #FF3B30;
  --green: #34C759;
  --orange: #FF9500;
  --sidebar-width: 250px;
  --header-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text-primary); background: linear-gradient(180deg, var(--bg-start), var(--bg-end)); min-height: 100vh; }

/* ── Login / Select Client ── */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; background: linear-gradient(135deg, #007EA7 0%, #005F80 50%, #003F5C 100%); }
.login-card { background: var(--white); border-radius: 20px; padding: 48px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card .logo { text-align: center; margin-bottom: 32px; }
.login-card .logo h1 { font-size: 28px; color: var(--primary); font-weight: 700; }
.login-card .logo p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.select-client-card { background: var(--white); border-radius: 20px; padding: 48px; width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.select-client-card h2 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.select-client-card .subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.client-search { width: 100%; padding: 10px 14px; border: 1px solid var(--border-light); border-radius: 10px; font-size: 14px; margin-bottom: 16px; outline: none; }
.client-list { max-height: 400px; overflow-y: auto; }
.client-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; }
.client-item:hover { background: var(--bg-start); }
.client-item.active { background: var(--primary-light); }
.client-item .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex-shrink: 0; }
.client-item .client-info { flex: 1; min-width: 0; }
.client-item .client-info .name { font-size: 15px; font-weight: 600; }
.client-item .client-info .status { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.client-pin { background: transparent; border: none; cursor: pointer; font-size: 20px; color: #B0B8C3; padding: 4px 8px; line-height: 1; transition: color 0.15s, transform 0.1s; }
.client-pin:hover { color: #367588; transform: scale(1.1); }
.client-pin.pinned { color: #F4B400; }
.client-section-label { font-size: 11px; font-weight: 700; color: var(--text-tertiary); letter-spacing: 0.06em; padding: 12px 12px 4px; text-transform: uppercase; }
.client-section-label:first-child { padding-top: 4px; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 12px 16px; border: 1px solid var(--border-light); border-radius: 10px; font-size: 15px; outline: none; transition: border 0.2s; font-family: inherit; background: var(--white); color: var(--text-primary); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.checkbox-row input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }
.checkbox-row label { font-size: 14px; color: var(--text-secondary); }
.btn-primary { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 24px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { padding: 14px; background: transparent; color: var(--primary); border: 1px solid var(--primary); border-radius: 24px; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn-danger { background: #C62828; color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn-danger:hover { background: #A31E1E; }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: var(--primary); text-decoration: none; font-size: 14px; }
.login-divider { text-align: center; margin: 24px 0; color: var(--text-tertiary); font-size: 13px; }

/* ── Desktop Shell ── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 20px; color: var(--primary); font-weight: 700; }
.sidebar-client { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px; background: var(--primary-light); border-radius: var(--radius-sm); cursor: pointer; }
.sidebar-client .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.sidebar-client .client-info { flex: 1; min-width: 0; }
.sidebar-client .client-info .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-client .client-info .role { font-size: 11px; color: var(--text-tertiary); }
.sidebar-client .switch-icon { color: var(--text-tertiary); font-size: 12px; flex-shrink: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { margin-bottom: 8px; }
.nav-section-title { padding: 8px 20px 4px; font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; transition: background 0.15s, color 0.15s; color: var(--text-secondary); font-size: 14px; text-decoration: none; border-radius: 8px; margin: 0 8px; position: relative; border: none; background: none; width: calc(100% - 16px); text-align: left; }
.nav-item:hover { background: rgba(0,126,167,0.08); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 25%; bottom: 25%; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.nav-item .badge { margin-left: auto; background: var(--red); color: white; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
/* .nav-link is an alias for .nav-item — keeps compatibility if any component uses that class */
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 8px; cursor: pointer; transition: background 0.15s, color 0.15s; font-size: 14px; color: var(--text-secondary); text-decoration: none; border: none; background: none; width: 100%; text-align: left; position: relative; }
.nav-link:hover { background: rgba(0,126,167,0.08); color: var(--primary); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 25%; bottom: 25%; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer .nav-item { margin: 0; width: 100%; }

/* Header */
.header { height: var(--header-height); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; }
/* Page title is kept in the markup for backward compatibility but the brand
   block below now shows the section name as a breadcrumb — so hide it. */
.header .page-title { display: none; }
/* Brand block: heart icon + "Loved Ones" + dynamic section breadcrumb.
   Lifted from the mobile mockup so the web shell carries the same identity
   on every page. Section text is whatever the existing OnParametersSet
   switch decided for _title. */
.header .brand-block { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.header .brand-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #FF6B9D, #C9184A);
    color: white; font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 4px rgba(201, 24, 74, 0.30);
    flex-shrink: 0;
}
.header .brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.header .brand-name { font-size: 16px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.3px; }
.header .brand-section { font-size: 11px; color: var(--text-tertiary); font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .search-box { width: 300px; padding: 8px 14px; border: 1px solid var(--border-light); border-radius: 8px; font-size: 14px; outline: none; background: var(--bg-start); }
.header .search-box:focus { border-color: var(--primary); background: white; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--bg-start); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; position: relative; }
.header-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid white; }
.header-user { display: flex; align-items: center; }
.header-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }

/* Main content area */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .filter-group { display: flex; gap: 4px; background: var(--white); border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--border-light); }
.toolbar .filter-btn { padding: 6px 16px; border: none; background: transparent; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text-secondary); font-weight: 500; }
.toolbar .filter-btn.active { background: var(--primary); color: white; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { font-size: 18px; font-weight: 700; }
.btn-add { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; background: var(--primary); color: white; border: none; border-radius: 20px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-add:hover { background: var(--primary-dark); }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--text-tertiary); padding: 6px 10px; border-radius: 6px; }
.btn-icon:hover { background: var(--bg-start); color: var(--text-primary); }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.data-table thead th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; background: #FAFBFD; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
.data-table thead th:hover { color: var(--primary); }
.data-table tbody td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #F0F2F5; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--bg-start); }
.data-table tbody tr:last-child td { border-bottom: none; }
.action-icons { display: flex; gap: 4px; }
.action-icons button { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--text-tertiary); padding: 4px 6px; border-radius: 4px; }
.action-icons button:hover { background: var(--bg-start); color: var(--text-primary); }

/* ── Status Badges ── */
.badge-status { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-status.active { background: #E8F9EE; color: #1B7A3D; }
.badge-status.pending { background: #FFF3E0; color: #E65100; }
.badge-status.overdue { background: #FFEAEA; color: #C62828; }
.badge-status.completed { background: #E8F4FD; color: var(--primary); }
.badge-status.edited { background: #E8F4FD; color: var(--primary); }
.badge-status.deleted { background: #FFEAEA; color: #C62828; }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px; }
.card:last-child { margin-bottom: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; font-weight: 700; }

/* ── Dashboard ── */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.dashboard-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.quick-action-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; transition: background 0.15s, border-color 0.15s; text-align: left; }
.quick-action-btn:hover { background: var(--primary-light); border-color: var(--primary); }

/* ── Master-Detail layout ── */
/* Negates .content padding so the list fills edge-to-edge */
.master-detail { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - var(--header-height)); overflow: hidden; margin: -24px; }
.master-list { border-right: 1px solid var(--border); overflow-y: auto; background: var(--white); }
.master-list-header { padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--white); z-index: 1; }

/* List items — support both .master-list-item (mockup) and .list-item (compat) */
.master-list-item, .list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  cursor: pointer; border-bottom: 1px solid #F0F2F5; transition: background 0.15s;
}
.master-list-item:hover, .list-item:hover { background: var(--bg-start); }
.master-list-item.selected, .list-item.selected { background: var(--primary-light); border-left: 3px solid var(--primary); }
.item-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-name, .list-item-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub, .list-item-subtitle { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* Detail panel */
.detail-panel { overflow-y: auto; padding: 24px; background: linear-gradient(180deg, var(--bg-start), var(--bg-end)); }
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.detail-header .detail-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; }
.detail-header .detail-info h2 { font-size: 22px; font-weight: 700; }
.detail-header .detail-info p { color: var(--text-secondary); font-size: 14px; }
.detail-section { margin-bottom: 16px; }
.detail-section h4 { font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }

/* Detail fields — support both naming conventions */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-field { display: flex; flex-direction: column; gap: 2px; }
.field-label { font-size: 12px; color: var(--text-tertiary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.field-value { font-size: 14px; font-weight: 500; color: var(--text-primary); }
/* Timesheets sidebar detail rows */
.detail-row { display: grid; grid-template-columns: 100px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-light); align-items: start; }
.detail-label { font-size: 12px; color: var(--text-tertiary); font-weight: 600; }
.detail-value { font-size: 13px; color: var(--text-primary); }

/* ── Inline search (toolbar) ── */
.search-inline { padding: 7px 14px; border: 1px solid var(--border-light); border-radius: 8px; font-size: 13px; outline: none; background: var(--white); color: var(--text-primary); width: 260px; }
.search-inline:focus { border-color: var(--primary); }

/* ── Chat ── */
.chat-layout { display: grid; grid-template-columns: 280px 1fr 220px; flex: 1; min-width: 0; overflow: hidden; }
.chat-rooms { border-right: 1px solid var(--border); overflow-y: auto; background: var(--white); }
.chat-rooms-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.chat-rooms-header h3 { font-size: 15px; font-weight: 700; }
.chat-room-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #F0F2F5; transition: background 0.15s; min-width: 0; }
.chat-room-item:hover { background: var(--bg-start); }
.chat-room-item.active,
.chat-room-item.selected { background: var(--primary-light); border-left: 3px solid var(--primary); }

/* Avatar — fixed size so room-info can shrink correctly */
.room-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Middle column — must be allowed to shrink (min-width:0) so truncation works */
.room-info { flex: 1; min-width: 0; }
.room-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-preview { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; word-break: break-word; }

/* Right column — timestamp + unread badge */
.room-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.room-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }
.unread { background: var(--primary); color: white; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }

/* Backwards-compat — earlier CSS referenced these names */
.chat-room-item .chat-room-name { font-size: 14px; font-weight: 600; }
.chat-room-item .chat-room-preview { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.unread-badge { background: var(--primary); color: white; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.chat-messages { display: flex; flex-direction: column; background: linear-gradient(180deg, var(--bg-start), var(--bg-end)); overflow: hidden; }
.chat-messages-header { padding: 14px 20px; background: var(--white); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 16px; flex-shrink: 0; }
.chat-messages-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 65%; width: fit-content; background: var(--white); border: 1px solid var(--border-light); border-radius: 16px; padding: 10px 14px; word-wrap: break-word; overflow-wrap: break-word; }
.chat-bubble.mine { background: var(--primary); border-color: var(--primary); color: white; }
.chat-bubble.mine .chat-text { color: white; }
.chat-bubble.mine .chat-time { color: #E6F0F5; }
.chat-sender { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.chat-text { font-size: 14px; line-height: 1.4; }
.chat-time { font-size: 11px; color: #5A6573; margin-top: 4px; }
.chat-input-area { padding: 12px 16px; background: var(--white); border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.chat-input { flex: 1; padding: 10px 16px; border: 1px solid var(--border-light); border-radius: 20px; font-size: 14px; outline: none; font-family: inherit; }
.chat-input:focus { border-color: var(--primary); }
.btn-send { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; font-size: 16px; flex-shrink: 0; }
/* width:100% so .chat-bubble's max-width:65% is a meaningful fraction of
   the full conversation pane — not 65% of the bubble's own content width
   (which used to force "That works" to wrap to three lines). */
.msg-row { display: flex; align-items: flex-end; gap: 6px; width: 100%; }
.msg-row-mine { flex-direction: row-reverse; }
.msg-actions { display: none; flex-direction: column; gap: 3px; align-self: center; }
.msg-row:hover .msg-actions { display: flex; }
.msg-action-btn { background: var(--bg-light); border: 1px solid var(--border-light); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); line-height: 1; }
.msg-action-btn:hover { background: #e8f4fd; border-color: var(--primary); color: var(--primary); }
.msg-action-btn.danger:hover { background: #fee2e2; border-color: #EF4444; color: #EF4444; }
.chat-edit-wrap { width: min(360px, 65vw); display: flex; flex-direction: column; gap: 6px; }
.chat-edit-input { width: 100%; padding: 8px 12px; border: 2px solid var(--primary); border-radius: 12px; font-size: 14px; font-family: inherit; resize: none; outline: none; line-height: 1.4; }
.chat-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-edit-save { background: var(--primary); color: white; border: none; border-radius: 8px; padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-edit-save:hover { background: var(--primary-dark, #005f80); }
.btn-edit-cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-light); border-radius: 8px; padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-edit-cancel:hover { background: var(--bg-light); }
.chat-members { border-left: 1px solid var(--border); overflow-y: auto; background: var(--white); padding: 16px; }
.chat-members-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chat-members-header h3 { font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; margin: 0; }

/* ── Timesheets Calendar ── */
.calendar-layout { display: grid; grid-template-columns: 1fr 350px; overflow: hidden; }
.calendar-main { overflow-y: auto; padding: 24px; background: var(--bg-start); }
.summary-bar { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--white); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); flex-shrink: 0; flex-wrap: wrap; }
.summary-bar .sum-item { display: flex; align-items: center; gap: 6px; }
.summary-bar .sum-value { font-size: 15px; font-weight: 700; color: var(--primary); }
.summary-bar .sum-label { font-size: 13px; color: var(--text-secondary); }
.summary-divider { width: 1px; height: 20px; background: var(--border); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-header { background: var(--primary); color: white; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; }
.cal-day { background: var(--white); min-height: 100px; padding: 8px; cursor: pointer; transition: background 0.1s; }
.cal-day:hover { background: var(--bg-start); }
.cal-day.selected { background: var(--primary-light); outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-day .day-num { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.cal-day.today .day-num { background: var(--primary); color: white; border-radius: 50%; }
.cal-day.other-month { opacity: 0.4; }
.cal-event { padding: 3px 6px; border-radius: 4px; font-size: 11px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event.shift { background: var(--primary-light); color: var(--primary); }
.cal-event.pending { background: #FFF3E0; color: #E65100; }
.cal-event.rejected { background: #FFEAEA; color: #C62828; }
.calendar-sidebar { border-left: 1px solid var(--border); background: var(--white); overflow-y: auto; padding: 20px; }
.calendar-sidebar h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.sidebar-date-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 12px; }
.entry-card { background: var(--bg-start); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; border-left: 3px solid var(--primary); cursor: pointer; transition: background 0.15s; }
.entry-card:hover { background: var(--primary-light); }
.entry-card.selected-card { background: var(--primary-light); border-left-color: var(--primary-dark); }
.entry-card.pending-card { border-left-color: #E65100; }
.entry-card.rejected-card { border-left-color: #C62828; }
.entry-card .entry-title { font-size: 14px; font-weight: 600; }
.entry-card .entry-time { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.entry-card .entry-hours { font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 6px; }
.entry-card.pending-card .entry-hours { color: #E65100; }
.entry-card.rejected-card .entry-hours { color: #C62828; }
.no-entries-msg { font-size: 13px; color: var(--text-tertiary); padding: 16px; text-align: center; }
/* Legacy support for old timesheets layout class */
.timesheets-layout { display: grid; grid-template-columns: 1fr 320px; overflow: hidden; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-card { z-index: 1001; background: var(--white); border-radius: 16px; width: 560px; max-width: calc(100% - 32px); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-body { overflow-y: auto; padding: 20px; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }
.modal-footer .btn-primary, .modal-footer .btn-secondary { width: auto; padding: 10px 24px; font-size: 14px; }

/* ── Misc ── */
.empty-state { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--text-tertiary); font-size: 14px; }
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--text-secondary); font-size: 14px; }
.error-message { background: #FFEBEE; color: #C62828; border: 1px solid rgba(198,40,40,0.2); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.spacer { flex: 1; }

/* ── Image Lightbox ── */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; z-index: 9999; cursor: zoom-out; animation: lb-fade-in 0.15s ease; }
@keyframes lb-fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-container { position: relative; max-width: 90vw; max-height: 90vh; cursor: default; animation: lb-scale-in 0.15s ease; }
@keyframes lb-scale-in { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-img { display: block; max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.lightbox-close { position: fixed; top: 16px; right: 20px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.15); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.25); cursor: pointer; font-size: 18px; font-weight: 700; color: white; display: flex; align-items: center; justify-content: center; line-height: 1; transition: background 0.15s; z-index: 10000; }
.lightbox-close:hover { background: rgba(255,255,255,0.28); }

/* ── Blazor validation ── */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--green); }
.invalid { outline: 1px solid var(--red); }
.validation-message { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Full-page layout wrapper (charting, medications, care team, timesheets) ── */
/* Fills the full viewport below the header; toolbar sits inside and panes fill the rest */
.full-page { display: flex; flex-direction: column; height: calc(100vh - var(--header-height)); margin: -24px; overflow: hidden; }
.full-page > .toolbar { margin-bottom: 0; padding: 12px 24px; background: var(--white); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.full-page > .master-detail { margin: 0; height: auto; flex: 1; min-height: 0; }
.full-page > .three-pane  { margin: 0; height: auto; flex: 1; min-height: 0; }
.full-page > .timesheets-layout { margin: 0; height: auto; flex: 1; min-height: 0; }
.full-page > .calendar-layout { margin: 0; height: auto; flex: 1; min-height: 0; }
.full-page > .chat-layout { margin: 0; flex: 1; min-height: 0; min-width: 0; }

/* ── 3-Pane Drill-Down (Charting) ── */
.three-pane { display: grid; grid-template-columns: 240px 280px 1fr; height: calc(100vh - var(--header-height)); overflow: hidden; margin: -24px; }
.pane-dates { border-right: 1px solid var(--border); overflow-y: auto; background: var(--white); }
.pane-entries { border-right: 1px solid var(--border); overflow-y: auto; background: var(--bg-start); }
.pane-detail { overflow-y: auto; background: linear-gradient(180deg, var(--bg-start), var(--bg-end)); }
.detail-section-title { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }
.date-section-header { padding: 8px 16px 6px; font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.6px; background: var(--bg-start); border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 1; }
.pane-section-header { padding: 8px 16px 6px; font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.6px; background: var(--bg-start); border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 1; }
.entry-count-badge { background: var(--primary); color: var(--white); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; flex-shrink: 0; }

/* ── Vital cards (charting entry detail) ── */
.vital-card { background: var(--white); border: 1px solid rgba(0,126,167,0.2); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.vital-card-header { display: flex; align-items: center; gap: 8px; background: rgba(0,126,167,0.12); padding: 8px 14px; border-bottom: 1px solid rgba(0,126,167,0.15); }
.vital-card-icon { font-size: 16px; }
.vital-card-title { font-size: 13px; font-weight: 700; color: var(--primary); }
.vital-card-body { padding: 12px 16px; display: flex; align-items: baseline; gap: 6px; }
.vital-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.vital-unit { font-size: 13px; color: var(--text-tertiary); font-weight: 500; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; min-width: 240px; max-width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); pointer-events: auto; animation: toast-in 0.3s ease; }
.toast-success { background: #1B7A3D; color: #fff; }
.toast-error { background: #C62828; color: #fff; }
.toast-info { background: var(--primary); color: #fff; }
.toast-icon { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-close { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 20px; cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0; }
.toast-close:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* ── Mobile Responsive ── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; align-items: center; justify-content: center; }

  /* Sidebar hidden by default on mobile */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  /* Shell with sidebar open */
  .shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }

  /* Backdrop when sidebar open */
  .shell.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
  }

  /* Main content full width on mobile */
  .main { margin-left: 0 !important; width: 100% !important; }

  /* Master-detail stacks vertically */
  .master-detail {
    flex-direction: column !important;
    overflow: visible !important;
  }
  .master-list {
    width: 100% !important;
    max-height: 280px;
    overflow-y: auto;
    border-right: none !important;
    border-bottom: 1px solid var(--border-light);
  }
  .detail-panel { width: 100% !important; }

  /* Calendar stacks */
  .calendar-layout {
    grid-template-columns: 1fr !important;
  }
  .calendar-sidebar { border-left: none !important; border-top: 1px solid var(--border-light); }

  /* Chat layout: hide members pane, stack rooms + messages */
  .chat-layout {
    flex-direction: column !important;
  }
  .chat-rooms {
    width: 100% !important;
    max-height: 200px;
    border-right: none !important;
    border-bottom: 1px solid var(--border-light);
  }
  .chat-messages { flex: 1 !important; min-height: 300px; }
  .chat-members { display: none !important; }

  /* Modals full-width on mobile */
  .modal-card {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    margin: 16px;
  }

  /* Login card full-width */
  .login-card { width: calc(100% - 40px) !important; padding: 32px 24px !important; }
  .select-client-card { width: calc(100% - 40px) !important; padding: 32px 24px !important; }

  /* Toolbar wraps on mobile */
  .toolbar { flex-wrap: wrap; gap: 8px; }

  /* Detail grid single column on small screens */
  .detail-grid { grid-template-columns: 1fr !important; }

  /* Header adjustments */
  .header-title { font-size: 15px !important; }
}

@media (max-width: 480px) {
  .summary-bar { flex-direction: column; gap: 8px; }
  .calendar-grid { gap: 2px; }
  .cal-header { font-size: 10px; padding: 4px 2px; }
}

/* ══════════════════════════════════════════════════════════════════
   Custom Forms — Mobile Preview Styles
   ══════════════════════════════════════════════════════════════════ */

.mobile-preview-wrap {
    padding: 0 0 16px;
}

/* Page bar (mimics MAUI navigation header) */
.pv-page-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}
.pv-back {
    font-size: 24px;
    line-height: 1;
    opacity: 0.8;
    cursor: default;
}
.pv-page-title {
    font-weight: 600;
    font-size: 15px;
}
.pv-preview-badge {
    margin-left: auto;
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    padding: 2px 9px;
    border-radius: 10px;
}

/* Frame card — one per grouping, mirrors MAUI Frame with BorderColor #33007EA7 */
.pv-frame {
    border: 1px solid rgba(0,126,167,0.22);
    border-radius: 6px;
    margin-top: 10px;
    overflow: hidden;
    background: white;
}
.pv-frame-header {
    background: rgba(0,126,167,0.10);
    color: #007EA7;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(0,126,167,0.14);
    letter-spacing: 0.1px;
}

/* Section label (field_type 14) — upper-case divider text */
.pv-section-label {
    padding: 8px 14px 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary, #aaa);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-top: 1px solid rgba(0,126,167,0.06);
}

/* Generic field row */
.pv-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-top: 1px solid rgba(0,126,167,0.06);
}
.pv-field-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}
.pv-label {
    font-size: 13px;
    color: var(--text-secondary, #555);
    flex: 1;
}
.pv-field-col .pv-label { flex: none; }

/* Text / date / time input */
.pv-input {
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    background: #FAFAFA;
    color: #aaa;
    width: 150px;
    flex-shrink: 0;
    cursor: default;
}

/* Textarea (comment) */
.pv-textarea {
    width: 100%;
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    background: #FAFAFA;
    color: #aaa;
    resize: none;
    box-sizing: border-box;
    cursor: default;
}

/* Toggle switch (CSS-only, no JS) */
.pv-toggle-row { justify-content: space-between; }
.pv-toggle {
    display: inline-block;
    width: 44px;
    height: 26px;
    background: #D0D5DD;
    border-radius: 13px;
    position: relative;
    flex-shrink: 0;
}
.pv-toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* Checkbox 2-per-row grid (mirrors MAUI 2-column Grid) */
.pv-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    padding: 4px 10px;
    border-top: 1px solid rgba(0,126,167,0.06);
}
.pv-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 50%;
    padding: 7px 4px;
    font-size: 13px;
    color: var(--text-secondary, #555);
    cursor: default;
    user-select: none;
}
.pv-checkbox-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: default;
}

/* Star / heart / number rating */
.pv-stars {
    display: flex;
    gap: 6px;
    padding: 3px 0;
}
.pv-star {
    font-size: 22px;
    color: #D0D5DD;
    cursor: default;
}

/* Emoji rating */
.pv-emojis {
    display: flex;
    gap: 10px;
    font-size: 22px;
    padding: 3px 0;
    opacity: 0.45;
}

/* Photo placeholder */
.pv-photo-placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #aaa;
    background: #F5F5F5;
    border: 1px dashed #D0D5DD;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: default;
}
