/* ═══════════════════════════════════════════════════════════════════
   Onnward – Application Styles
   Fonts: DM Sans (body) + Fraunces (display)
   Palette: Warm charcoal + Terracotta accent + Soft cream
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Core palette */
    --bg:              #faf8f5;
    --bg-card:         #ffffff;
    --bg-accent:       #fef4ee;
    --bg-hover:        #f5f2ee;
    --bg-input:        #ffffff;

    --text:            #2c2520;
    --text-secondary:  #7a6f66;
    --text-muted:      #b5aa9e;
    --text-inverse:    #faf8f5;

    --accent:          #c4562a;
    --accent-hover:    #a8461f;
    --accent-light:    #fce8de;

    --success:         #2d8a56;
    --success-bg:      #e6f4ec;
    --warning:         #c48a2a;
    --warning-bg:      #fef6e6;
    --danger:          #c43a2a;
    --danger-bg:       #fce8e6;
    --info:            #2a6fc4;
    --info-bg:         #e6f0fc;

    --border:          #e8e2da;
    --border-light:    #f0ebe5;
    --shadow-sm:       0 1px 3px rgba(44, 37, 32, 0.06);
    --shadow-md:       0 4px 12px rgba(44, 37, 32, 0.08);
    --shadow-lg:       0 8px 30px rgba(44, 37, 32, 0.1);

    --radius-sm:       6px;
    --radius:          10px;
    --radius-lg:       16px;
    --radius-xl:       24px;

    --font-body:       'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display:    'Fraunces', Georgia, serif;

    --nav-height:      64px;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.25; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.85rem; letter-spacing: -0.01em; }
h2 { font-weight: 600; font-size: 1.15rem; }
h3 { font-weight: 600; font-size: 1rem; }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ─── NAVIGATION ─── */
.nav-main {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent-light); color: var(--accent); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nav-user-name { font-weight: 500; }

/* ─── AVATARS ─── */
.avatar-sm  { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-xs  { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent-light); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.15rem;
}

/* ─── MAIN CONTENT ─── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ─── PAGE HEADER ─── */
.page-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.page-header h1 { flex: 1; min-width: 200px; }
.page-subtitle { width: 100%; color: var(--text-secondary); font-size: 0.95rem; margin-top: -0.25rem; }
.page-meta { width: 100%; display: flex; gap: 0.5rem; align-items: center; }

.back-link {
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: -0.25rem;
}
.back-link:hover { color: var(--accent); }

/* ─── CARDS ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-empty {
    padding: 1.5rem 0;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9rem;
}

/* ─── DASHBOARD GRID ─── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
}

.card-wide { grid-column: 1 / -1; }

/* ─── ITEM LIST ─── */
.item-list { list-style: none; }

.item-row a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    transition: background 0.12s;
}

.item-row:last-child a { border-bottom: none; }
.item-row a:hover { background: var(--bg-hover); margin: 0 -0.75rem; padding-left: 0.75rem; padding-right: 0.75rem; border-radius: var(--radius-sm); }

.item-label { flex: 1; font-weight: 500; font-size: 0.9rem; }
.item-meta { color: var(--text-muted); font-size: 0.8rem; }

/* ─── BADGES ─── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-draft        { background: var(--bg-hover); color: var(--text-muted); }
.badge-submitted    { background: var(--info-bg); color: var(--info); }
.badge-reviewed     { background: var(--success-bg); color: var(--success); }
.badge-active       { background: var(--success-bg); color: var(--success); }
.badge-pending_approval { background: var(--warning-bg); color: var(--warning); }
.badge-completed    { background: var(--success-bg); color: var(--success); }
.badge-cancelled    { background: var(--danger-bg); color: var(--danger); }
.badge-pending      { background: var(--warning-bg); color: var(--warning); }
.badge-in_progress  { background: var(--info-bg); color: var(--info); }
.badge-role         { background: var(--accent-light); color: var(--accent); }

/* ─── PROGRESS BAR ─── */
.progress-bar, .progress-bar-mini, .progress-bar-lg {
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar       { height: 8px; width: 100%; margin-top: 0.5rem; }
.progress-bar-mini  { height: 4px; width: 80px; }
.progress-bar-lg    { height: 12px; width: 100%; }

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #e07a52);
    border-radius: 999px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.progress-label    { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; display: block; }
.progress-label-lg { font-size: 0.9rem; color: var(--text-secondary); margin-top: 0.4rem; display: block; font-weight: 500; }

/* ─── GOALS GRID ─── */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.goal-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
    color: var(--text);
}

.goal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--text); }

.goal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.goal-card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.goal-type-tag { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.goal-period { font-size: 0.8rem; color: var(--text-muted); }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead th {
    text-align: left;
    padding: 0.65rem 0.75rem;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.table tbody td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover { background: var(--bg-hover); }

/* ─── FORMS ─── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 680px;
    box-shadow: var(--shadow-sm);
}

.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.form-input {
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: var(--bg-input);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder { color: var(--text-muted); }

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237a6f66' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.2rem;
}

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-row.compact { align-items: flex-end; }

.form-input-sm { max-width: 120px; }
.form-input-xs { max-width: 80px; }

.form-divider { border: none; border-top: 1px solid var(--border-light); margin: 1rem 0; }
.form-section { margin-top: 1.25rem; }
.form-section-title { margin-bottom: 0.25rem; }
.form-hint { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.75rem; }

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

.required { color: var(--danger); }

/* Dynamic form rows */
.kr-row, .question-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.kr-row .form-input:first-child, .question-row .form-input:first-child { flex: 1; }

/* ─── BUTTONS ─── */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.55rem 1.25rem;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-hover); color: var(--text-inverse); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.55rem 1.25rem;
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}

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

.btn-danger {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.55rem 1.25rem;
    background: var(--danger);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-danger:hover { background: #a83020; color: var(--text-inverse); }

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.btn-sm:hover { background: #f8d5c2; }

.btn-full { width: 100%; }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.3rem 0;
}

.btn-link:hover { color: var(--accent-hover); }
.btn-link-danger { background: none; border: none; color: var(--danger); font-size: 0.8rem; cursor: pointer; }

/* ─── GOOGLE SIGN-IN ─── */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-card);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-body);
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}

.btn-google:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

/* ─── AUTH PAGES ─── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(196, 86, 42, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(196, 86, 42, 0.04) 0%, transparent 50%),
        var(--bg);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-brand { margin-bottom: 2rem; }
.brand-mark-lg { color: var(--accent); font-size: 2.5rem; font-weight: 700; display: block; margin-bottom: 0.25rem; }
.auth-brand h1 { font-family: var(--font-display); font-size: 1.8rem; }
.auth-tagline { color: var(--text-secondary); font-size: 0.95rem; margin-top: 0.25rem; }

.auth-fine-print { font-size: 0.75rem; color: var(--text-muted); margin-top: 1.25rem; }

.invite-info { margin-bottom: 1.5rem; }
.invite-info p { color: var(--text-secondary); font-size: 0.9rem; }
.invite-info h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 0.25rem 0; }

/* ─── FLASH MESSAGES ─── */
.flash-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 0;
}

.flash {
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error   { background: var(--danger-bg); color: var(--danger); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }
.flash-info    { background: var(--info-bg); color: var(--info); }

.flash-dismiss {
    background: none;
    border: none;
    font-size: 1.15rem;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0 0.25rem;
}

/* ─── MOOD PICKER ─── */
.mood-picker { display: flex; gap: 0.5rem; }

.mood-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-option input { display: none; }

.mood-emoji {
    font-size: 1.8rem;
    padding: 0.4rem;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: all 0.15s;
}

.mood-option input:checked + .mood-emoji {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.15);
}

.mood-large { font-size: 2.5rem; }

/* ─── RATING PICKER ─── */
.rating-picker { display: flex; gap: 0.35rem; }

.rating-option {
    cursor: pointer;
}

.rating-option input { display: none; }

.rating-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}

.rating-option input:checked + span {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

.radio-group { display: flex; gap: 1rem; font-size: 0.9rem; }
.radio-group label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }

/* ─── DETAIL BLOCKS ─── */
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 720px;
}

.detail-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.detail-block h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.detail-block p { font-size: 0.95rem; white-space: pre-wrap; }

.detail-block-accent {
    background: var(--bg-accent);
    border-color: var(--accent-light);
}

/* ─── KEY RESULTS ─── */
.kr-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.kr-item:last-child { border-bottom: none; }
.kr-title { font-weight: 500; font-size: 0.9rem; }
.kr-progress { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }

/* ─── TIMELINE ─── */
.timeline { list-style: none; }

.timeline-item {
    position: relative;
    padding: 0.6rem 0 0.6rem 1.25rem;
    border-left: 2px solid var(--border);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0.85rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.timeline-date { font-size: 0.78rem; color: var(--text-muted); }
.timeline-user { font-size: 0.82rem; font-weight: 600; margin-left: 0.5rem; }
.timeline-progress { font-size: 0.82rem; color: var(--accent); font-weight: 600; }
.timeline-item p { font-size: 0.88rem; margin-top: 0.2rem; }

/* ─── TEAM GRID ─── */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.person-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: box-shadow 0.2s;
}

.person-card:hover { box-shadow: var(--shadow-md); }

.person-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.person-avatar img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.person-card h3 { font-size: 0.95rem; }
.person-title { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.15rem; }
.person-dept { display: block; font-size: 0.75rem; color: var(--text-muted); margin: 0.25rem 0; }

/* ─── DEPT TABS ─── */
.dept-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.dept-tab {
    padding: 0.4rem 0.9rem;
    border: none;
    background: var(--bg-hover);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-body);
    transition: all 0.15s;
}

.dept-tab:hover { background: var(--border); }
.dept-tab.active { background: var(--accent); color: var(--text-inverse); }

/* ─── ADMIN NAV ─── */
.admin-nav {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.admin-tab {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── SPLIT LAYOUT ─── */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; }

/* ─── INLINE FORM ─── */
.inline-form { margin-top: 1rem; }

/* ─── HELPERS ─── */
.text-muted { color: var(--text-muted); }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .nav-inner { padding: 0 1rem; gap: 1rem; }
    .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-user-name { display: none; }
    .main-content { padding: 1.5rem 1rem 3rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .split-layout { grid-template-columns: 1fr; }
    .team-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    h1 { font-size: 1.5rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .auth-card { padding: 1.75rem; border-radius: var(--radius-lg); }
    .form-card { padding: 1.25rem; }
    .kr-row, .question-row { flex-direction: column; }
    .kr-row .form-input, .question-row .form-input { max-width: none; }
}
