@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font: Inter, "Segoe UI", system-ui, sans-serif;
    --navy: #1e3a8a;
    --navy-deep: #0f172a;
    --bg: #eef2f7;
    --panel: #ffffff;
    --sidebar: linear-gradient(180deg, #1e3a8a 0%, #0f172a 100%);
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --input-border: #d1d5db;
    --error: #fecaca;
    --error-text: #450a0a;
    --shadow-card: 0 20px 50px rgba(15, 23, 42, 0.18);
    --shadow-panel: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius-lg: 16px;
    --radius: 10px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

h1, h2, h3, .page-title {
    letter-spacing: -0.03em;
    font-weight: 700;
    color: var(--text);
}

a { color: var(--primary); }

/* ——— Auth (login / forgot) ——— */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}

.auth-card {
    width: min(420px, 92vw);
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-card);
}

.brand { text-align: center; margin-bottom: 1.5rem; }
.brand-logo { max-width: 180px; height: auto; }
.brand-tagline {
    color: var(--muted);
    margin: .55rem 0 0;
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.page-title { margin: 0 0 1.15rem; font-size: 1.35rem; }

.stack-form label { display: block; margin-bottom: 1rem; }
.stack-form span {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: .4rem;
}
.stack-form input,
.stack-form textarea,
.stack-form select {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.stack-form select[multiple] { min-height: 8rem; }
.stack-form small.muted { display: block; margin-top: .35rem; font-weight: 400; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: .15rem .5rem; vertical-align: middle; }
.badge-feedback { background: #fef3c7; color: #92400e; }
.badge-fb-open { background: #e0e7ff; color: #3730a3; }
.badge-fb-acknowledged { background: #dbeafe; color: #1e40af; }
.badge-fb-in_progress { background: #dbeafe; color: #1e40af; }
.badge-fb-on_hold { background: #e5e7eb; color: #374151; }
.badge-fb-next_phase { background: #e0e7ff; color: #4338ca; }
.badge-fb-completed { background: #dcfce7; color: #166534; }
.badge-fb-resolved { background: #dcfce7; color: #166534; }
.badge-fb-need_to_discuss { background: #fef3c7; color: #92400e; }

.feedback-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin: .5rem 0;
}
.feedback-status-row label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    margin: 0;
}
.feedback-status-row select {
    font: inherit;
    font-weight: 400;
    padding: .25rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.feedback-shot { position: relative; display: inline-block; max-width: 100%; margin: .75rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.feedback-shot img { display: block; max-width: 100%; height: auto; }
.feedback-pin {
    position: absolute;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50% 50% 50% 0;
    background: #dc2626;
    transform: rotate(-45deg);
    box-shadow: 0 3px 9px rgba(220, 38, 38, .55);
    border: 2px solid #fff;
}

.feedback-tech {
    margin: .5rem 0 .75rem;
    font-size: .85rem;
    color: var(--muted);
}
.feedback-tech summary {
    cursor: pointer;
    user-select: none;
    color: var(--text);
    font-weight: 500;
}
.feedback-tech pre {
    margin: .4rem 0 0;
    padding: .55rem .7rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .78rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--muted);
}
.timeline-item .msg-body { margin: .35rem 0 0; }

.field-label { display: block; font-size: .875rem; font-weight: 500; color: #4b5563; margin-bottom: .4rem; }
.code-snippet {
    background: #0f172a;
    color: #dbeafe;
    font-family: "SF Mono", Consolas, monospace;
    font-size: .78rem;
    padding: .8rem .9rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    margin: 0 0 .5rem;
}

.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: .7rem 1.05rem;
    font-weight: 600;
    font-family: inherit;
    font-size: .95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: background .15s, color .15s, box-shadow .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: #334155; }
.btn-ghost:hover { background: #f3f4f6; }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .7rem; font-size: .875rem; }
.btn:disabled { opacity: .65; cursor: not-allowed; }

.hidden { display: none !important; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .925rem; }
.alert-error { background: var(--error); color: var(--error-text); }
.alert-info { background: #dbeafe; color: #1e3a8a; }
.muted-link { text-align: center; margin-top: 1.15rem; }
.muted-link a { color: var(--primary); font-weight: 500; text-decoration: none; }
.muted-link a:hover { text-decoration: underline; }

/* ——— App shell ——— */
.app-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 1.4rem 1.1rem;
}
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1.5rem;
    padding: 0;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.sidebar-brand img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    background: #fff;
}
.sidebar-brand span {
    margin-top: .45rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #dbeafe;
    text-align: right;
}
.sidebar-nav { display: grid; gap: .28rem; }
.nav-link {
    color: #dbeafe;
    text-decoration: none;
    padding: .7rem .8rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .925rem;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active {
    background: rgba(255,255,255,.16);
    color: #fff;
    box-shadow: inset 3px 0 0 #93c5fd;
}

.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.6rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.topbar h1 { margin: 0; font-size: 1.28rem; }
.topbar-user { display: flex; align-items: center; gap: .75rem; color: #374151; font-weight: 500; }
.inline-form { display: inline; margin: 0; }

.content { padding: 1.6rem; }
.lead { color: var(--muted); margin-top: 0; font-size: 1rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-panel);
}
.stat-label { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { font-size: 1.8rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.04em; }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-panel);
}
.panel h2 { margin-top: 0; font-size: 1.15rem; }
.panel p { color: #4b5563; }
.checklist { margin: .75rem 0 0; padding-left: 1.2rem; color: #4b5563; }

.data-table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.data-table th, .data-table td {
    text-align: left;
    padding: .75rem .55rem;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.is-selected { background: #eff6ff; }

@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

.toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input[type="search"],
.toolbar select {
    min-width: 200px;
    padding: .5rem .75rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .925rem;
}
.toolbar input:focus,
.toolbar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.toolbar-filters input[type="search"] { min-width: 200px; flex: 1 1 180px; max-width: 280px; }
.toolbar-filters select { min-width: 132px; max-width: 180px; }
.toolbar-filters.is-filtered { gap: .65rem; }
.quick-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 50; }
.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    width: min(480px, 92vw);
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-card);
}
.modal-card h2 { margin-top: 0; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

.view-toggle { margin-left: auto; display: flex; gap: .25rem; background: #f3f4f6; padding: .2rem; border-radius: var(--radius-sm); }
.view-toggle .btn { background: transparent; color: #4b5563; }
.view-toggle .active { background: var(--primary); color: #fff; }

.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 1rem; overflow-x: auto; }
.kanban-col { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); padding: .75rem; min-height: 280px; }
.kanban-col h3 { margin: 0 0 .75rem; font-size: .95rem; color: #475569; }
.kanban-card { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); padding: .65rem; margin-bottom: .5rem; cursor: grab; box-shadow: var(--shadow-panel); }

.layout-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 960px) { .layout-split { grid-template-columns: 1fr; } }

.timeline { margin: 1rem 0; }
.timeline-item { border-left: 3px solid var(--primary); padding: .5rem 0 .5rem 1rem; margin-bottom: .75rem; }
.timeline-item.internal { border-color: #f59e0b; background: #fffbeb; padding-left: .75rem; border-radius: 0 8px 8px 0; }
.timeline-item time { display: block; font-size: .8rem; color: var(--muted); }

.timer-widget {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-variant-numeric: tabular-nums;
    background: #f1f5f9;
    padding: .3rem .6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.wizard-steps { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wizard-steps .step { padding: .35rem .75rem; border-radius: 999px; background: #e2e8f0; font-size: .875rem; font-weight: 600; color: #475569; }
.wizard-steps .step.active { background: var(--primary); color: #fff; }
.wizard-panel label { display: block; margin-bottom: .5rem; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.cal-head { font-weight: 600; font-size: .8rem; color: var(--muted); text-align: center; padding: .35rem; }
.cal-cell { min-height: 90px; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); padding: .35rem; font-size: .85rem; background: #fff; }
.cal-cell.empty { background: #f8fafc; }
.cal-event { background: #dbeafe; color: #1e40af; border-radius: 4px; padding: .15rem .35rem; margin-top: .25rem; font-size: .75rem; font-weight: 600; }

.muted { color: var(--muted); }
#gantt { min-height: 320px; }
