/* DrinksBox Onboarding Tracker — Minimal Utility CSS */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #dee2e6;
    --text: #212529;
    --text-muted: #6c757d;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --overdue: #dc2626;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* Nav */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    text-decoration: none;
}
.nav-links { display: flex; gap: 20px; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.nav-links a:hover { color: var(--primary); }
.nav-user {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 4px;
}
.nav-logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    margin-left: 2px;
}
.nav-logout:hover { color: var(--danger); }

/* Login page */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    width: 100%;
}
.btn-google:hover {
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Public onboarding form */
.onboard-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}
.onboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 560px;
    width: 100%;
}
.onboard-header {
    margin-bottom: 28px;
}
.onboard-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.onboard-header p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Onboard link section on supplier page */
.onboard-link-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.onboard-link-section.inactive {
    background: #f8fafc;
    border-color: var(--border);
}
.onboard-link-url {
    font-family: monospace;
    font-size: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    flex: 1;
    min-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; font-weight: 700; }

/* Flash messages */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.filters select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--surface);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.table th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.table tbody tr:hover { background: #f8fafc; }

/* Row states */
.row-complete { opacity: 0.6; }
.row-overdue { background: #fef2f2 !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 4px 10px; font-size: 12px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-active { background: #dbeafe; color: #1e40af; }
.badge-stalled { background: #fef3c7; color: #92400e; }
.badge-complete { background: #dcfce7; color: #166534; }
.badge-overdue { background: #fecaca; color: #991b1b; }

/* Milestone badges */
.milestone-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    color: white;
}
.milestone-5 { background: #8b5cf6; }
.milestone-6 { background: #3b82f6; }
.milestone-7 { background: #06b6d4; }
.milestone-8 { background: #f59e0b; }
.milestone-9 { background: #16a34a; }

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-not_started { background: #e5e7eb; color: #4b5563; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-complete { background: #dcfce7; color: #166534; }
.status-blocked { background: #fef3c7; color: #92400e; }

/* Owner pill */
.owner-pill {
    display: inline-block;
    padding: 1px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Progress bar */
.progress-bar {
    width: 80px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s;
}
.progress-text { font-size: 12px; color: var(--text-muted); }

/* Supplier link */
.supplier-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.supplier-link:hover { text-decoration: underline; }

/* Supplier meta */
.supplier-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.supplier-notes {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Milestone groups */
.milestone-group {
    margin-bottom: 24px;
}
.milestone-header {
    font-size: 16px;
    font-weight: 700;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.milestone-header:hover { background: #f8fafc; }
.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
}
.collapsed .collapse-icon { transform: rotate(-90deg); }
.collapsed .milestone-tasks { display: none; }
.milestone-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: auto;
}

/* Task table */
.task-table { border-radius: 0 0 var(--radius) var(--radius); }

.task-notes {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.completion-info {
    font-size: 11px;
    color: var(--success);
    margin-top: 2px;
}
.blocked-info {
    font-size: 12px;
    color: #b45309;
    font-style: italic;
}

.next-action { font-weight: 500; margin-right: 6px; }

/* Text helpers */
.text-muted { color: var(--text-muted); }
.text-overdue { color: var(--overdue); font-weight: 600; }
.text-strikethrough { text-decoration: line-through; color: var(--text-muted); }

/* Forms */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 640px;
    box-shadow: var(--shadow);
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
.form-group textarea { resize: vertical; }
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Add task form (inline) */
.add-task-section {
    margin-top: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.add-task-section h3 { font-size: 15px; margin-bottom: 12px; }
.add-task-form .form-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.add-task-form select,
.add-task-form input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.input-small {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
}

/* Actions column */
.actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 16px; }

/* Delivery zones — accordion layout */
.zone-accordion {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.zone-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.zone-header:hover { background: #f1f5f9; }
.zone-header .collapse-icon {
    font-size: 10px;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}
.zone-title {
    font-weight: 700;
    font-size: 14px;
}
.zone-meta { margin-left: 4px; }
.zone-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.zone-costs {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}
.zone-edit-btn { margin-left: 8px; }
.zone-header-unassigned { background: #fff7ed; }
.zone-header-unassigned:hover { background: #ffedd5; }

.zone-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fefce8;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.zone-edit-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.zone-edit-form label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.zone-postcodes { /* collapsible body */ }
.zone-table {
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
}
.zone-empty {
    padding: 16px;
    font-size: 13px;
    text-align: center;
}

/* Postcode search */
.postcode-search {
    margin-bottom: 20px;
}
.postcode-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.postcode-search-input:focus {
    outline: none;
    border-color: var(--primary);
}
.search-result {
    margin-top: 10px;
    padding: 12px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.6;
    max-width: 600px;
}

.zone-add {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.grid-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    width: 80px;
}
.grid-input-wide { width: 200px; }
.zone-select {
    width: 160px;
    padding: 3px 6px;
    font-size: 11px;
}
.row-unassigned { background: #fff7ed !important; }
.row-unassigned:hover { background: #ffedd5 !important; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
    .form-row { flex-direction: column; }
    .add-task-form .form-row { flex-direction: column; }
}
