/* =============================================================================
   BEAM — Project Drive Styles
   Design: Basecamp-simple, monochrome, typography-first
   ============================================================================= */

:root {
    --bg: #fafafa;
    --card: #ffffff;
    --text: #111;
    --muted: #777;
    --subtle: #bbb;
    --border: #e5e5e5;
    --border-strong: #ccc;
    --accent: #111;
    --accent-hover: #333;
    --success-bg: #e8f5e9;
    --success-text: #2e7d32;
    --error-bg: #fce4ec;
    --error-text: #c62828;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
    --radius: 6px;
    --radius-lg: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    font-size: 14px;
}

/* =============================================================================
   HEADER — Minimal nav with BEAM logo, search, logout
   ============================================================================= */

header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 1.25rem;
    max-width: 100%;
}

/* Logo: thick rounded box */
.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.logo-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--text);
    color: var(--card);
    font-weight: 800;
    font-size: 16px;
    border-radius: 8px;
    letter-spacing: -0.5px;
}

.logo-text {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
}

/* Search */
.header-centre {
    flex: 1;
    max-width: 400px;
    margin: 0 auto;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--border-strong);
}

.search-box input::placeholder {
    color: var(--subtle);
}

/* Search dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 300;
}

.search-dropdown {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.search-section-title {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.search-item {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
}

.search-item:hover {
    background: var(--bg);
}

.search-item-meta {
    display: block;
    font-size: 11px;
    color: var(--muted);
}

/* User / logout */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-phone {
    color: var(--muted);
    font-size: 13px;
}

.settings-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.settings-link:hover {
    color: var(--text);
}

.logout-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

.logout-link:hover {
    color: var(--text);
}

/* =============================================================================
   FLASH MESSAGES
   ============================================================================= */

.flash-messages {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem;
}

.flash {
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 13px;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
}

/* =============================================================================
   3-PANE DRIVE LAYOUT
   ============================================================================= */

.drive {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 50px);
}

.drive-main {
    display: grid;
    grid-template-columns: 1fr 280px;
    position: relative;
}

/* =============================================================================
   LEFT SIDEBAR — Project tree
   ============================================================================= */

.drive-sidebar {
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem 1rem 0.5rem;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.project-node {
    border-bottom: 1px solid var(--border);
}

.project-node > summary {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
}

.project-node > summary::-webkit-details-marker {
    display: none;
}

.project-node > summary::before {
    content: "\25B8";
    margin-right: 0.5rem;
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.15s;
}

.project-node[open] > summary::before {
    transform: rotate(90deg);
}

.project-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--subtle);
    font-weight: 400;
}

.tree-folder {
    display: flex;
    align-items: center;
    padding: 0.375rem 1rem 0.375rem 2rem;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.tree-folder:hover {
    background: var(--bg);
    color: var(--text);
}

.tree-folder-name {
    flex: 1;
}

.sidebar-divider {
    border-top: 1px solid var(--border);
    margin: 0.5rem 1rem;
}

.tree-count {
    font-size: 11px;
    color: var(--subtle);
}

.sidebar-empty {
    padding: 2rem 1rem;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.sidebar-empty code {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12px;
}

/* =============================================================================
   CENTRE PANE — Timeline file list
   ============================================================================= */

.drive-centre {
    padding: 1.25rem;
    overflow-y: auto;
}

.centre-header {
    margin-bottom: 1.5rem;
}

.centre-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.centre-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.centre-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

/* Audit download button */
.btn-audit-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.btn-audit-download:hover {
    background: var(--bg);
    border-color: var(--text);
}

.btn-audit-download:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-audit-spinner {
    font-weight: 500;
    color: var(--muted);
}

.breadcrumb {
    font-size: 12px;
    color: var(--muted);
    margin-right: 0.75rem;
}

.project-client {
    font-size: 12px;
    color: var(--muted);
}

/* Timeline groups */
.timeline-group {
    margin-bottom: 0.25rem;
}

.timeline-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 0.75rem 0 0.375rem;
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.timeline-label::-webkit-details-marker {
    display: none;
}

.timeline-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* File cards */
.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
    margin-bottom: 4px;
}

.file-card:hover {
    border-color: var(--border-strong);
}

.file-card-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.file-type-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    white-space: nowrap;
    min-width: 70px;
}

.file-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.file-status {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
}

.status-draft { color: var(--muted); }
.status-issued { color: var(--text); font-weight: 600; }
.status-approved { color: var(--success-text); }
.status-sent { color: var(--text); }
.status-complete { color: var(--success-text); }

.file-date {
    font-size: 11px;
    color: var(--subtle);
    white-space: nowrap;
}

.file-actions {
    opacity: 0;
    transition: opacity 0.15s;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.action-btn {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.action-btn:hover {
    background: var(--border);
}

.centre-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted);
    font-size: 14px;
}

.centre-empty code {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12px;
}

/* =============================================================================
   RIGHT PANE — Chat history
   ============================================================================= */

.drive-chat {
    background: var(--card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 12px;
    max-width: 90%;
}

.chat-beam {
    background: var(--bg);
    align-self: flex-start;
}

.chat-user {
    background: var(--text);
    color: var(--card);
    align-self: flex-end;
}

.chat-sender {
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chat-beam .chat-sender { color: var(--muted); }
.chat-user .chat-sender { color: var(--subtle); }

.chat-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-time {
    font-size: 10px;
    margin-top: 4px;
}

.chat-beam .chat-time { color: var(--subtle); }
.chat-user .chat-time { color: var(--subtle); }

.chat-empty {
    color: var(--subtle);
    font-size: 12px;
    text-align: center;
    padding: 2rem;
}

/* =============================================================================
   DETAIL OVERLAY — Document detail / edit (slide-in panel)
   ============================================================================= */

.detail-overlay:empty {
    display: none;
}

.detail-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 16px rgba(0,0,0,0.06);
    z-index: 250;
    overflow-y: auto;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.detail-card {
    padding: 1.5rem;
}

.detail-close {
    float: right;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--muted);
}

.detail-close:hover {
    background: var(--bg);
    color: var(--text);
}

.detail-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 0.375rem 0;
}

.detail-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

.detail-no-file {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.action-btn--primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}
.action-btn--primary:hover {
    opacity: 0.85;
}

/* PDF preview */
.detail-preview {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #f5f5f5;
}

.pdf-preview {
    width: 100%;
    height: 400px;
    display: block;
    border: none;
}

.pdf-fallback {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}
.pdf-fallback a {
    color: var(--text);
    text-decoration: underline;
}

.detail-preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
}

.preview-filetype {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
}

.detail-preview-info a {
    color: var(--text);
    text-decoration: underline;
    font-size: 12px;
}

/* =============================================================================
   VERSION HISTORY
   ============================================================================= */

.version-history {
    margin-top: 1.5rem;
}

.version-history h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 0 0 0.75rem 0;
}

.version-row {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
}

.version-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.version-num {
    font-weight: 700;
    font-size: 12px;
    font-family: var(--mono);
}

.version-label {
    font-size: 13px;
}

.version-status {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.version-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.version-diff-toggle {
    margin-top: 0.375rem;
}

.version-diff-toggle summary {
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.version-diff-toggle summary:hover {
    color: var(--text);
}

.version-empty {
    font-size: 12px;
    color: var(--subtle);
}

/* Diff table */
.diff-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.diff-table th {
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}

.diff-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.diff-field {
    font-weight: 500;
    white-space: nowrap;
}

.diff-old {
    color: var(--error-text);
    text-decoration: line-through;
}

.diff-new {
    color: var(--success-text);
}

/* =============================================================================
   AUTH PAGES (login, verify)
   ============================================================================= */

.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--card);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
}

.auth-container h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
}

.auth-container p {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.auth-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: center;
}

.auth-container input:focus {
    outline: none;
    border-color: var(--text);
}

.auth-container button {
    width: 100%;
    padding: 0.75rem;
    font-size: 14px;
    font-weight: 600;
    background: var(--text);
    color: var(--card);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.auth-container button:hover {
    background: var(--accent-hover);
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1rem;
}

.hint a {
    color: var(--text);
}

/* =============================================================================
   FORMS (edit variation, edit diary)
   ============================================================================= */

.edit-form {
    max-width: 600px;
    margin: 2rem auto;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

.back-link:hover {
    color: var(--text);
}

.edit-form h1 {
    margin: 0 0 0.25rem 0;
    font-size: 18px;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 1.5rem;
    font-size: 13px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    font-family: var(--font);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--text);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background: var(--text);
    color: var(--card);
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 12px;
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

/* =============================================================================
   FOOTER
   ============================================================================= */

footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--subtle);
    font-size: 12px;
}

.drive ~ footer { display: none; }

/* =============================================================================
   LANDING PAGE — Stealth mode
   ============================================================================= */

.landing-body {
    background: #000;
    color: #fafafa;
    min-height: 100vh;
}

.landing {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.landing-hero {
    text-align: center;
    padding: 3rem 0 2rem;
    background: transparent;
    border-bottom: none;
    position: static;
}

.landing-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

/* "BEAM" in thick rounded border — hero logo for landing pages */
.logo-border {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
    border: 4px solid #fff;
    border-radius: 18px;
    padding: 0.3rem 1.5rem;
    line-height: 1.2;
}

.logo-border--sm {
    font-size: 1.5rem;
    border-width: 3px;
    border-radius: 12px;
    padding: 0.2rem 1rem;
}

.landing-logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.landing-hero--compact {
    padding: 2rem 0 1rem;
    background: transparent;
    border-bottom: none;
    position: static;
}

.landing-tagline {
    font-size: 1.25rem;
    font-weight: 400;
    color: #ccc;
    margin: 0 0 0.5rem 0;
}

.landing-sub {
    font-size: 0.9rem;
    color: #888;
    margin: 0;
}

/* Features */
.landing-features {
    padding: 2rem 0;
}

.feature-row {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #222;
    border: 1px solid #333;
    font-size: 12px;
    font-weight: 700;
    color: #888;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #eee;
}

.feature p {
    font-size: 13px;
    color: #777;
    margin: 0;
}

/* CTA */
.landing-cta {
    text-align: center;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cta-btn {
    display: inline-block;
    padding: 0.75rem 2.5rem;
    background: #fafafa;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.cta-btn:hover {
    opacity: 0.85;
}

.cta-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}
.cta-link:hover {
    color: #aaa;
}

/* Footer */
.landing-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.landing-footer p,
.landing-footer a {
    font-size: 11px;
    color: #555;
    margin: 0.25rem 0;
    text-decoration: none;
}

.landing-footer a:hover {
    color: #888;
}

/* =============================================================================
   SUBSCRIBE PAGE
   ============================================================================= */

.subscribe-card {
    text-align: center;
    padding: 1rem 0 2rem;
}

.subscribe-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: #fafafa;
}

.subscribe-desc {
    font-size: 14px;
    color: #888;
    max-width: 420px;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

/* Waitlist form */
.waitlist-form {
    max-width: 360px;
    margin: 0 auto 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.waitlist-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 14px;
    font-family: var(--font);
    background: #111;
    color: #fafafa;
    border: 1px solid #333;
    border-radius: var(--radius);
}

.waitlist-form input::placeholder {
    color: #555;
}

.waitlist-form input:focus {
    outline: none;
    border-color: #666;
}

.waitlist-form .cta-btn {
    margin-top: 0.5rem;
    width: 100%;
    text-align: center;
}

.waitlist-success {
    padding: 2rem 0;
}

.waitlist-success h2 {
    color: #fff;
    margin-bottom: 0.75rem;
}

.waitlist-success p {
    color: #888;
    font-size: 14px;
}

.subscribe-contact {
    font-size: 12px;
    color: #444;
}

/* =============================================================================
   INVITE ONLY BADGE (login page)
   ============================================================================= */

.invite-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: var(--surface, #f5f5f5);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
    margin-bottom: 1rem;
}

/* =============================================================================
   LEGACY COMPAT
   ============================================================================= */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.messages { margin-bottom: 1rem; }
.message { padding: 0.625rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; font-size: 13px; }
.message-success { background: var(--success-bg); color: var(--success-text); }
.message-error { background: var(--error-bg); color: var(--error-text); }

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

@media (max-width: 900px) {
    .drive {
        grid-template-columns: 1fr;
    }

    .drive-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
        overflow-y: auto;
    }

    .drive-main {
        grid-template-columns: 1fr;
    }

    .drive-chat {
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 300px;
    }

    .detail-overlay {
        width: 100%;
    }

    .file-actions {
        opacity: 1;
    }

    .file-card {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .file-card-left {
        flex-basis: 100%;
    }

    .file-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .file-type-badge {
        min-width: auto;
    }

    .file-card-right {
        flex-basis: 100%;
        flex-shrink: 1;
        padding-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .centre-header-top {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-audit-download {
        align-self: flex-start;
    }
}


/* =============================================================================
   PROJECT CALENDAR — Airline-booking compact month view
   ============================================================================= */

.cal {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    margin-bottom: 16px;
    overflow: hidden;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.cal-month-label {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.cal-nav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    line-height: 1;
}
.cal-nav-btn:hover {
    background: var(--surface);
    border-color: var(--text-muted);
}

/* Grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.cal-head {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.cal-head.cal-weekend {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Day cells */
.cal-day {
    min-height: 52px;
    padding: 3px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.cal-day:nth-child(7n) {
    border-right: none;
}

.cal-day-num {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.cal-day--out {
    background: var(--surface);
    opacity: 0.4;
}

.cal-day--today {
    background: #f0f7ff;
}
.cal-day--today .cal-day-num {
    color: #0066cc;
    font-weight: 700;
}

.cal-day--past .cal-day-num {
    color: var(--text-muted);
}

.cal-day--has-events {
    cursor: default;
}

/* Event pills */
.cal-events {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cal-ev {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 9px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-ev-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.cal-ev-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Event type colours */
.cal-ev--diary { background: #f0f4e8; }
.cal-ev--diary .cal-ev-icon { background: #5a8a3c; }

.cal-ev--trade { background: #e8f0f8; }
.cal-ev--trade .cal-ev-icon { background: #2a6cb6; }

.cal-ev--delivery { background: #fdf4e8; }
.cal-ev--delivery .cal-ev-icon { background: #c67a1a; }

.cal-ev--doc_event { background: #f0e8f4; }
.cal-ev--doc_event .cal-ev-icon { background: #7a3cb6; }

.cal-ev--note { background: #f4f4f0; }
.cal-ev--note .cal-ev-icon { background: #666; }

.cal-ev--variation { background: #fdeaea; }
.cal-ev--variation .cal-ev-icon { background: #c0392b; }

.cal-ev--delay {
    background: #fce4e4;
    border-left: 2px solid #c0392b;
}

/* Clickable calendar events */
.cal-ev--clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}
.cal-ev--clickable:hover {
    opacity: 0.75;
}

/* Legend */
.cal-legend {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.cal-legend-item .cal-ev-icon {
    width: 12px;
    height: 12px;
    font-size: 7px;
}

/* Collapse toggle */
.cal-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
}
.cal-toggle:hover {
    color: var(--text);
}

/* Responsive: stack event pills on small cells */
@media (max-width: 900px) {
    .cal-day {
        min-height: 40px;
        padding: 2px;
    }
    .cal-ev-label {
        display: none;
    }
    .cal-ev {
        padding: 1px;
        justify-content: center;
    }
    .cal-legend {
        gap: 8px;
    }
}

/* =============================================================================
   INVITE MANAGEMENT
   ============================================================================= */

.invite-manage {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.invite-manage h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
}

.invite-manage > p {
    color: var(--muted);
    margin-bottom: 2rem;
    font-size: 13px;
}

.invite-form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.invite-form-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.invite-form-card .form-hint {
    display: block;
    font-size: 11px;
    color: var(--subtle);
    margin-top: 0.25rem;
}

.btn-primary {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    background: var(--text);
    color: var(--card);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* Invite result / URL display */
.invite-success {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--success-bg);
    border-radius: var(--radius);
}

.invite-success p {
    margin: 0 0 0.5rem 0;
    font-size: 13px;
}

.invite-url-box {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.invite-url-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-family: var(--mono);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
}

.btn-copy {
    padding: 0.5rem 1rem;
    font-size: 13px;
    font-weight: 600;
    background: var(--text);
    color: var(--card);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--accent-hover);
}

.invite-error {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: var(--radius);
    font-size: 13px;
}

/* Invite list table */
.invite-list-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.invite-list-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.invite-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invite-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.invite-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.invite-table code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.invite-row.invite-status-expired {
    opacity: 0.5;
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pending {
    color: #b8860b;
    background: #fff8dc;
}

.status-used {
    color: var(--success-text);
    background: var(--success-bg);
}

.status-expired {
    color: var(--muted);
    background: var(--bg);
}

.empty-state {
    color: var(--subtle);
    font-size: 13px;
    text-align: center;
    padding: 2rem;
}

/* Activate page (public invite entry) */
.activate-card {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
}

.activate-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
}

.activate-card p {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 1rem;
    text-align: left;
}

.whatsapp-box {
    text-align: center;
    padding: 1.5rem;
    margin: 1rem 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.whatsapp-number {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--mono);
    margin: 0 0 1rem 0;
}

.btn-whatsapp {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #25d366;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
}

.btn-whatsapp:hover {
    background: #20bd5a;
}

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline;
}

/* =============================================================================
   DIARY DAY DETAIL
   ============================================================================= */

.diary-day-detail {
    /* padding provided by .detail-card when loaded in sidebar overlay */
}

.diary-day-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.diary-day-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.diary-summary-card {
    background: linear-gradient(135deg, #f0f4e8 0%, #e8f0f8 100%);
    border: 1px solid #d4dcc8;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.diary-summary-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.diary-summary-item {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.4;
}

.diary-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.diary-section:last-child {
    border-bottom: none;
}

.diary-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.diary-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.diary-section-header h4 {
    margin-bottom: 0;
}

.diary-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.diary-row.diary-alert {
    background: #fef3f3;
    border-left: 3px solid #c0392b;
    padding: 0.4rem 0.5rem;
    margin: 0.25rem 0;
    border-radius: 0 4px 4px 0;
}

.diary-label {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 6rem;
    flex-shrink: 0;
}

.diary-trade-type {
    font-weight: 600;
}

.diary-time,
.diary-supplier {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.diary-amount {
    font-weight: 600;
    color: #2a6cb6;
}

.diary-controls,
.diary-action {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    width: 100%;
}

.diary-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Badge variants */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-grey { background: #f5f5f5; color: #757575; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.badge-red { background: #ffebee; color: #c62828; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-note { background: #f3f0ff; color: #5a3db5; }

.badge-planned { background: #e8f0f8; color: #2a6cb6; }
.badge-confirmed { background: #e8f5e9; color: #2e7d32; }
.badge-completed { background: #e8f5e9; color: #2e7d32; }
.badge-no_show { background: #ffebee; color: #c62828; }
.badge-cancelled { background: #f5f5f5; color: #757575; }
.badge-expected { background: #fff3e0; color: #e65100; }
.badge-delivered { background: #e8f5e9; color: #2e7d32; }

.badge-draft { background: #f5f5f5; color: #757575; }
.badge-sent { background: #e3f2fd; color: #1565c0; }
.badge-approved { background: #e8f5e9; color: #2e7d32; }
.badge-rejected { background: #ffebee; color: #c62828; }

.badge-low { background: #e8f5e9; color: #2e7d32; }
.badge-medium { background: #fff3e0; color: #e65100; }
.badge-high { background: #ffebee; color: #c62828; }
.badge-critical { background: #f3e5f5; color: #6a1b9a; }

/* Interactive trade & activity pill buttons */
.trade-pill, .activity-pill {
    cursor: pointer;
    margin: 0.2rem;
    transition: all 0.15s ease;
    border: none;
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
}
.trade-pill:hover, .activity-pill:hover { opacity: 0.8; }
.trade-pill.selected { background: #1565c0; color: #fff; }
.pill-container { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.suggestion-section { margin-bottom: 1rem; }
.suggestion-section label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.85rem; }
.suggestion-text {
    cursor: pointer;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary, #1565c0);
    font-size: 0.9rem;
    white-space: pre-wrap;
}
.suggestion-text:hover { background: #e8f0fe; }
.weather-summary { font-size: 0.9rem; margin: 0.2rem 0; }
.weather-warning { color: #c62828; font-size: 0.85rem; margin: 0.2rem 0; }
.checklist { padding-left: 1.2rem; font-size: 0.85rem; color: #757575; }
.checklist li { margin-bottom: 0.3rem; }

.diary-risk {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}


/* =============================================================================
   ACTIONS DROPDOWN MENU (CSS-only, no JS)
   ============================================================================= */

.actions-menu {
    position: relative;
    display: inline-block;
}

.actions-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    list-style: none;
}

.actions-menu-toggle::-webkit-details-marker {
    display: none;
}
.actions-menu-toggle::marker {
    display: none;
    content: '';
}

.actions-menu-toggle:hover {
    background: var(--bg);
}

.actions-menu-icon {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.actions-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 4px 0;
}

.actions-menu[open] .actions-menu-dropdown {
    display: block;
}

.actions-menu-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 0.825rem;
    font-family: var(--font);
    color: var(--text);
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.actions-menu-item:hover {
    background: var(--bg);
}

.actions-menu-item--danger {
    color: var(--error-text);
}

.actions-menu-item--danger:hover {
    background: var(--error-bg);
}

.actions-menu-item--success {
    color: var(--success-text);
}

.actions-menu-item--success:hover {
    background: var(--success-bg);
}

.actions-menu-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* Close dropdown when clicking elsewhere (details[open] auto-closes on click outside) */
.actions-menu[open] .actions-menu-toggle {
    background: var(--bg);
    border-color: var(--border-strong);
}

/* Mobile: dropdown goes full-width */
@media (max-width: 640px) {
    .actions-menu-dropdown {
        position: fixed;
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 8px;
        min-width: auto;
        border-radius: var(--radius-lg);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    }

    .actions-menu-item {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}


/* =============================================================================
   PROJECT CLOSURE
   ============================================================================= */

/* Sidebar: closed project indicator */
.project-closed .project-name {
    color: var(--muted);
}

.project-badge-closed {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: var(--border);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* Header: status badge for closed projects */
.project-status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 10px;
    border-radius: var(--radius);
}

.status-closed {
    color: var(--muted);
    background: var(--border);
}

/* Close / reopen action buttons in header */
.btn-close-action {
    color: var(--error-text) !important;
    border-color: var(--error-text) !important;
}

.btn-close-action:hover {
    background: var(--error-bg) !important;
}

.btn-reopen-action {
    color: var(--success-text) !important;
    border-color: var(--success-text) !important;
}

.btn-reopen-action:hover {
    background: var(--success-bg) !important;
}

/* Close project form panel */
.close-project-panel {
    padding: 24px;
    max-width: 480px;
}

.close-project-panel h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.close-project-address {
    font-weight: 600;
    margin: 0 0 12px;
}

.close-project-info {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.close-open-items {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.close-open-items ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.close-open-items-note {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 6px 0 0;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    margin-top: 12px;
    color: var(--text);
}

.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.875rem;
    background: var(--card);
}

.form-textarea {
    resize: vertical;
}

.close-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.btn-close-project {
    background: var(--error-text);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-close-project:hover {
    opacity: 0.9;
}

.btn-cancel-close {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-cancel-close:hover {
    background: var(--bg);
}

/* Post-closure panel */
.project-closed-panel {
    padding: 24px;
    max-width: 480px;
}

.project-closed-panel h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    color: var(--success-text);
}

.close-audit-prompt {
    background: var(--success-bg);
    border: 1px solid #a5d6a7;
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}

.close-audit-prompt strong {
    display: block;
    margin-bottom: 4px;
}

.close-audit-prompt p {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 4px 0 12px;
}

.btn-download-audit {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-download-audit:hover {
    background: var(--accent-hover);
}

.close-reopen-note {
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--muted);
}

.btn-reopen-project {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 6px 16px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 6px;
}

.btn-reopen-project:hover {
    background: var(--bg);
}

/* =============================================================================
   INVITE PAGE — Guided landing page for beta invitees
   Dark theme matching landing page
   ============================================================================= */

.invite-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

.invite-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.invite-headline {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
}

.invite-sub {
    font-size: 0.95rem;
    color: #999;
    margin: 0;
}

/* Sections */
.invite-section {
    padding: 2rem 0;
    border-top: 1px solid #222;
}

.invite-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.75rem;
}

.invite-section-desc {
    font-size: 0.9rem;
    color: #aaa;
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

/* Feature list */
.invite-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.invite-features li {
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.invite-features li strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #eee;
    margin-bottom: 4px;
}

.invite-features li span {
    font-size: 0.825rem;
    color: #888;
    line-height: 1.5;
}

/* Video cards — grid layout for vertical Shorts */
.invite-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 600px) {
    .invite-videos-grid {
        grid-template-columns: 1fr;
        max-width: 280px;
        margin: 0 auto;
    }
}

.invite-video-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
}

/* Standard 16:9 embed */
.invite-video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #0a0a0a;
}

/* Vertical Shorts embed (9:16) */
.invite-video-short {
    padding-bottom: 177.78%;
}

.invite-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.invite-video-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #eee;
    margin: 0;
    padding: 0.75rem 0.75rem 0.25rem;
}

.invite-video-desc {
    font-size: 0.75rem;
    color: #777;
    margin: 0;
    padding: 0 0.75rem 0.75rem;
    line-height: 1.4;
}

/* Placeholder boxes (for videos/screenshots not yet uploaded) */
.invite-placeholder-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.85rem;
    border: 1px dashed #333;
    border-radius: 8px;
}

/* Screenshot */
.invite-screenshot {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #222;
    background: #0a0a0a;
}

.invite-screenshot img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.invite-screenshot .invite-placeholder-box {
    position: relative;
    padding: 4rem 1rem;
}

/* Activation CTA */
.invite-activate {
    text-align: center;
}

.invite-activate .invite-section-title {
    font-size: 1.25rem;
}

.invite-whatsapp-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.invite-whatsapp-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--mono);
    margin: 0 0 1rem;
}

.invite-btn-activate {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    background: #25d366;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity 0.15s;
}

.invite-btn-activate:hover {
    opacity: 0.85;
}

.invite-hint {
    font-size: 0.8rem;
    color: #666;
    margin: 1rem 0 0;
}

.invite-sandbox-warning {
    background: #332b00;
    border: 1px solid #665500;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #ffcc00;
    font-size: 0.85rem;
    text-align: left;
}

.invite-sandbox-warning code {
    background: #222;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* =============================================================================
   ACCOUNT SETTINGS PAGE
   ============================================================================= */

.settings-page {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.settings-page h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
}

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.settings-tab {
    padding: 0.625rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    color: var(--muted);
    cursor: pointer;
}

.settings-tab:hover {
    color: var(--text);
}

.settings-tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.settings-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.settings-desc {
    color: var(--muted);
    font-size: 12px;
    margin: 0 0 0.75rem 0;
}

.settings-saved {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 1rem;
}

/* Toggle rows */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--text);
}

.time-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
}

.time-picker label {
    color: var(--muted);
    font-size: 12px;
}

.time-picker input[type="time"] {
    font-family: var(--font);
    font-size: 13px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

/* Certification table */
.cert-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}

.cert-table th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.cert-table td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.cert-add-form {
    margin-top: 0.5rem;
}

.cert-add-form .form-row {
    gap: 0.5rem;
    align-items: flex-end;
}

.btn-small {
    font-size: 12px;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    font-family: var(--font);
}

.btn-small:hover {
    background: var(--bg);
}

.btn-danger {
    color: var(--error-text);
    border-color: var(--error-text);
}

.btn-danger:hover {
    background: var(--error-bg);
}

/* =============================================================================
   CLIENT LINE ITEM (Project timeline)
   ============================================================================= */

/* Show actions always (no hover needed) */
.client-actions-visible {
    opacity: 1 !important;
}

/* Inline missing-fields hint within the file-card row */
.client-missing {
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
}

/* Edit panel (inline expansion) */
.client-edit-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 4px;
}

.client-edit-panel h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.client-edit-panel h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 0.75rem 0;
}

.client-edit-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}


/* =============================================================================
   WEEK VIEW — Moleskine-clean columns with Monday.com-style activity bars
   ============================================================================= */

/* ── Tab toggle (shared by week + month views) ── */

.cal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.cal-tab {
    padding: 7px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font);
}

.cal-tab:hover {
    color: var(--text);
}

.cal-tab--active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.cal-tab--book {
    margin-left: auto;
    color: #2a6cb6;
    font-weight: 600;
}

.cal-tab--book:hover {
    color: #1a4c86;
}

/* ── Week container ── */

.wk {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* ── Week nav bar ── */

.wk-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.wk-today-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
}

.wk-range {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-left: auto;
    letter-spacing: 0.01em;
}

/* ── Status ribbon ── */

.wk-ribbon {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.wk-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.wk-pill--confirmed { background: #e8f5e9; color: #2e7d32; }
.wk-pill--planned   { background: #e3f2fd; color: #1565c0; }
.wk-pill--progress  { background: #e0f2f1; color: #00695c; }
.wk-pill--blocked   { background: #ffebee; color: #c62828; }

/* ── Column grid ── */

.wk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    min-height: 180px;
}

.wk-col {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.wk-col:last-child {
    border-right: none;
}

/* ── Column header (day name + number) ── */

.wk-col-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    position: relative;
}

.wk-day-name {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.wk-day-num {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1;
}

.wk-day-num--today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text);
    color: var(--card);
    font-weight: 700;
    font-size: 12px;
}

/* Diary dot — small green dot to show diary is logged */
.wk-diary-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #5a8a3c;
    display: inline-block;
    margin-left: auto;
}

.wk-diary-dot--legend {
    width: 7px;
    height: 7px;
}

/* ── Column body ── */

.wk-col-body {
    padding: 6px 6px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wk-empty {
    color: var(--subtle);
    font-size: 11px;
    text-align: center;
    padding: 12px 0;
}

/* ── Day state modifiers ── */

.wk-col--today {
    background: #f5f9ff;
}

.wk-col--today .wk-col-head {
    background: #edf3fb;
    border-bottom-color: #d0dfef;
}

.wk-col--past {
    opacity: 0.6;
}

.wk-col--past:hover {
    opacity: 0.85;
}

.wk-col--weekend .wk-col-head {
    background: #f8f8f6;
}

.wk-col--weekend .wk-day-name {
    color: var(--subtle);
}

/* ── Activity bars ── */

.wk-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    cursor: default;
    transition: box-shadow 0.15s;
    position: relative;
    min-height: 26px;
}

.wk-bar:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Status-specific bar colours */
.wk-bar--confirmed {
    background: #e8f5e9;
    border-left: 3px solid #2e7d32;
}

.wk-bar--planned {
    background: #e3f2fd;
    border-left: 3px solid #1565c0;
}

.wk-bar--in_progress {
    background: #e0f2f1;
    border-left: 3px solid #00695c;
}

.wk-bar--blocked {
    background: #ffebee;
    border-left: 3px solid #c62828;
}

.wk-bar--completed {
    background: #f5f5f5;
    border-left: 3px solid #bbb;
    opacity: 0.6;
}

.wk-bar--suggested,
.wk-bar--ghost {
    background: #fafafa;
    border-left: 3px solid var(--subtle);
    border-style: dashed;
    opacity: 0.75;
}

.wk-bar--ghost:hover {
    opacity: 1;
    background: #f5f5f5;
}

/* Category-specific overrides (subtle right-side icon tint) */
.wk-bar--delivery.wk-bar--confirmed { background: #fef8ef; border-left-color: #c67a1a; }
.wk-bar--delivery.wk-bar--planned { background: #fef8ef; border-left-color: #d48a2a; }
.wk-bar--inspection.wk-bar--confirmed { background: #f0e8f4; border-left-color: #7a3cb6; }
.wk-bar--inspection.wk-bar--planned { background: #f0e8f4; border-left-color: #8a4cc6; }
.wk-bar--milestone.wk-bar--confirmed { background: #f8f0e0; border-left-color: #9a7b4f; }

/* ── Status dot (small coloured circle, in-bar) ── */

.wk-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.wk-dot--confirmed   { background: #2e7d32; }
.wk-dot--planned     { background: #1565c0; }
.wk-dot--in_progress { background: #00695c; }
.wk-dot--blocked     { background: #c62828; }
.wk-dot--completed   { background: #bbb; }
.wk-dot--suggested   { background: var(--subtle); border: 1px dashed var(--muted); }

/* ── Category icon (T, D, I, B, M) ── */

.wk-cat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    line-height: 1;
}

/* Category icon backgrounds */
.wk-bar--trade .wk-cat     { background: #2a6cb6; }
.wk-bar--delivery .wk-cat  { background: #c67a1a; }
.wk-bar--inspection .wk-cat { background: #7a3cb6; }
.wk-bar--builder .wk-cat   { background: #555; }
.wk-bar--milestone .wk-cat { background: #9a7b4f; }

/* Ghost/suggested bars get muted icon */
.wk-bar--ghost .wk-cat { background: var(--subtle); }

/* ── Bar label ── */

.wk-bar-label {
    flex: 1;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.wk-bar--ghost .wk-bar-label {
    color: var(--muted);
    font-style: italic;
}

.wk-bar--completed .wk-bar-label {
    text-decoration: line-through;
    color: var(--muted);
}

/* ── Time slot badge ── */

.wk-slot {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 1px 4px;
    background: rgba(0,0,0,0.04);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Contact line (below bar) ── */

.wk-contact {
    font-size: 10px;
    color: var(--muted);
    padding: 0 6px 2px 30px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Blocked callout ── */

.wk-blocked-callout {
    font-size: 10px;
    color: #c62828;
    padding: 2px 6px 2px 30px;
    line-height: 1.3;
}

/* ── Inline action buttons ── */

.wk-bar-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.wk-bar:hover .wk-bar-actions {
    opacity: 1;
}

/* Ghost/suggested bars always show actions */
.wk-bar--ghost .wk-bar-actions {
    opacity: 1;
}

.wk-inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.wk-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 11px;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    line-height: 1;
    font-family: var(--font);
    transition: background 0.1s, color 0.1s;
}

.wk-act:hover {
    background: var(--bg);
    color: var(--text);
}

.wk-act--accept:hover,
.wk-act--confirm:hover,
.wk-act--done:hover {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.wk-act--dismiss:hover {
    background: #ffebee;
    color: #c62828;
    border-color: #ffcdd2;
}

/* ── Suggestions panel ── */

.wk-suggestions {
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.wk-sug-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}

.wk-sug-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.wk-sug-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border);
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
}

.wk-sug-accept-all {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
}

.wk-sug-accept-all:hover {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: #2e7d32;
}

.wk-sug-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
}

.wk-sug-row:last-child {
    border-bottom: none;
}

.wk-sug-source {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--subtle);
    min-width: 60px;
}

.wk-sug-label {
    flex: 1;
    color: var(--muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.wk-sug-date {
    font-size: 10px;
    color: var(--subtle);
    flex-shrink: 0;
}

/* Confidence visual hint */
.wk-sug-row--high .wk-sug-label  { color: var(--text); font-style: normal; }
.wk-sug-row--low .wk-sug-source  { opacity: 0.5; }

/* ── Legend ── */

.wk-legend {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    flex-wrap: wrap;
}

.wk-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--muted);
}

/* ── Responsive: stack columns on small screens ── */

@media (max-width: 640px) {
    .wk-grid {
        grid-template-columns: 1fr;
    }

    .wk-col {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .wk-col:last-child {
        border-bottom: none;
    }

    .wk-col-head {
        padding: 6px 10px 4px;
    }

    .wk-bar-actions {
        opacity: 1;
    }
}

@media (max-width: 900px) and (min-width: 641px) {
    .wk-bar-label {
        font-size: 10px;
    }

    .wk-contact {
        display: none;
    }
}

