:root {
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --primary: #0284c7;
    --primary-hover: #0369a1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

.auth-card {
    max-width: 420px;
    margin: 4rem auto;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-card input {
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.auth-card button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    cursor: pointer;
}

.auth-error {
    color: #dc2626;
}

.auth-hint {
    color: #475569;
    font-size: 0.95rem;
}

.app-header {
    background: #0f172a;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo-highlight {
    color: #38bdf8;
}

.app-subtitle {
    font-size: 0.875rem;
    color: #94a3b8;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #38bdf8;
}

/* Tooltips: hover or keyboard-focus any element with a data-tooltip
   attribute to show its text in a small dark bubble above it - pure CSS,
   no JS/library needed (unlike top40poll's Bootstrap-based
   data-bs-toggle="tooltip" + title="..." pattern - this app doesn't load
   Bootstrap, and a plain title attribute alone gives an unstyled, slow-to-
   appear native tooltip). Keep the text short - it doesn't wrap. */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.user-pill {
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 0.25rem 2rem 0 2rem;
}

.app-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.page-container {
    max-width: 1000px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tr:hover {
    background-color: #f8fafc;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

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

.btn-action {
    background-color: #e2e8f0;
    color: #334155;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-action:hover {
    background-color: #cbd5e1;
}

.card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.muted {
    color: #64748b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-grid label {
    display: block;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.25rem;
}

.form-grid input, .form-grid select, .form-grid textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-tile {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 140px;
}

.stat-tile .stat-label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-tile .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}

/* badge-flag-rev, not badge-flag-rev-overdue: the class is built from just
   the flag's first word (t.flag.split(' ')[0]) - "REV OVERDUE" -> "rev".
   A real bug found 2026-09-07: this selector previously said
   `.badge-flag-rev-overdue`, which that split() can never produce, so
   REV OVERDUE flags rendered with the default grey badge, not this one. */
.badge-flag-overdue, .badge-flag-rev {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-flag-who, .badge-flag-turnover, .badge-flag-timelogs {
    background: #fef3c7;
    color: #92400e;
}

.badge-flag-flow {
    background: #dbeafe;
    color: #1d4ed8;
}

.shot-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 220px);
    /* No align-items: start (was added earlier to stop the fixed-height/
    overflow-hidden card from clipping tasks) - now that cards size to
    their own content, the default `stretch` pads every card in a row out
    to match the tallest one instead, per Martin: a uniform bottom edge
    across the row rather than a ragged one. */
    gap: 1rem;
}

.shot-card {
    width: 220px;
    box-sizing: border-box;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    break-inside: avoid;
}

.shot-card-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #f1f5f9;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.shot-card-thumbnail-empty {
    border: 1px dashed #cbd5e1;
}

.shot-card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.shot-card-title a {
    color: inherit;
    text-decoration: none;
}

.shot-card-tasks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.shot-card-task {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

@media print {
    .app-header, .feedback-widget, .no-print {
        display: none;
    }
}

textarea.import-paste {
    width: 100%;
    min-height: 220px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
}

.import-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.import-result {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.feedback-widget {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1000;
}

.feedback-toggle {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    list-style: none;
    user-select: none;
}

.feedback-toggle::-webkit-details-marker {
    display: none;
}

.feedback-form {
    margin-top: 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    width: 320px;
    max-width: calc(100vw - 3rem);
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.feedback-field {
    font-size: 0.85rem;
    color: #475569;
    display: block;
}

.feedback-form select,
.feedback-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    margin-top: 0.25rem;
}

.feedback-screenshot-tools {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.feedback-canvas {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: crosshair;
}

.feedback-error {
    color: #dc2626;
    font-size: 0.8rem;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.status-picker {
    display: flex;
    gap: 0.25rem;
}

.status-picker input[type=text] {
    flex: 1;
    width: auto;
    min-width: 0;
}

.status-picker-menu {
    position: relative;
    flex-shrink: 0;
}

.status-picker-menu summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0.7rem;
}

.status-picker-menu summary::-webkit-details-marker {
    display: none;
}

.status-picker-options {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 20;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    min-width: 220px;
    overflow: hidden;
}

.status-picker-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.status-picker-option:hover {
    background: #f1f5f9;
}
