/* Local fonts */
@font-face {
    font-family: 'Instrument Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/instrument-serif-400.ttf') format('truetype');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-400.ttf') format('truetype');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-500.ttf') format('truetype');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-600.ttf') format('truetype');
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-700.ttf') format('truetype');
}

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
    --bg-app: #f5f4f0;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,.08);
    --radius: 10px;
    --sidebar-width: 260px;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    letter-spacing: -.02em;
}

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

/* ============================================================
   Layout – App Shell
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 0;
}

.content-inner {
    padding: 2rem 2.5rem;
    max-width: 1280px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    gap: .625rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: .875rem;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-family: 'Instrument Serif', serif;
    font-size: 1.0625rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-section-label {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: .75rem 1.5rem .25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem 1.5rem;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    border-radius: 0;
    transition: color .15s, background .15s;
    text-decoration: none;
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.sidebar-link.active {
    font-weight: 600;
}

.project-color-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================================
   Top Bar
   ============================================================ */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.breadcrumb-nav {
    font-size: .8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: .375rem;
}

.breadcrumb-nav a { color: var(--text-secondary); }
.breadcrumb-nav a:hover { color: var(--accent); }

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow .2s;
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    font-weight: 600;
    font-size: .9375rem;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: .875rem;
    font-weight: 500;
    border-radius: 8px;
    padding: .5rem 1rem;
    line-height: 1.5;
    transition: background .15s, border-color .15s, box-shadow .15s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    color: #fff;
}

.btn-sm {
    font-size: .8125rem;
    padding: .3125rem .75rem;
    border-radius: 6px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-control, .form-select {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: .875rem;
    border-color: var(--border-color);
    border-radius: 8px;
    padding: .5625rem .875rem;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
    outline: none;
}

.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: .375rem;
}

/* ============================================================
   Status Badges
   ============================================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem .625rem;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.status-planung     { background: #f1f5f9; color: #475569; }
.status-aktiv       { background: #dcfce7; color: #166534; }
.status-pausiert    { background: #fef9c3; color: #854d0e; }
.status-abgeschlossen { background: #ede9fe; color: #5b21b6; }
.status-archiviert  { background: #f1f5f9; color: #9ca3af; }

.status-offen       { background: #f1f5f9; color: #475569; }
.status-in_arbeit   { background: #dbeafe; color: #1e40af; }
.status-review      { background: #fef9c3; color: #854d0e; }
.status-erledigt    { background: #dcfce7; color: #166534; }

.priority-niedrig   { background: #f1f5f9; color: #475569; }
.priority-mittel    { background: #dbeafe; color: #1e40af; }
.priority-hoch      { background: #ffedd5; color: #9a3412; }
.priority-dringend  { background: #fee2e2; color: #991b1b; }

/* ============================================================
   Progress Bar
   ============================================================ */
.progress {
    height: 6px;
    border-radius: 100px;
    background: var(--border-color);
    overflow: hidden;
}

.progress-bar {
    background: var(--accent);
    border-radius: 100px;
    transition: width .4s ease;
}

/* ============================================================
   Project Card (Dashboard / List)
   ============================================================ */
.project-card {
    border-left: 3px solid var(--accent);
}

.project-card-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ============================================================
   Task Item
   ============================================================ */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: .75rem 1rem;
    border-radius: 8px;
    transition: background .15s;
    cursor: pointer;
}

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

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-drag-handle {
    color: var(--border-color);
    cursor: grab;
    padding: 0 .25rem;
    font-size: .875rem;
}

.task-drag-handle:active { cursor: grabbing; }

/* ============================================================
   Kanban Board
   ============================================================ */
.kanban-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.kanban-column {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-width: 280px;
    width: 280px;
    flex-shrink: 0;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: .875rem;
    gap: .5rem;
}

.kanban-column-count {
    background: var(--border-color);
    color: var(--text-secondary);
    border-radius: 100px;
    padding: .125rem .5rem;
    font-size: .75rem;
    font-weight: 600;
}

.kanban-list {
    padding: .75rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: .625rem;
}

.kanban-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: .875rem;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: box-shadow .15s, transform .1s;
}

.kanban-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-1px);
}

.kanban-card.sortable-ghost {
    opacity: .4;
    background: var(--accent-light);
}

.kanban-card.sortable-drag {
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* ============================================================
   Timeline / Zeitstrahl
   ============================================================ */
.timeline-grid {
    overflow-x: auto;
}

.timeline-bar {
    height: 24px;
    border-radius: 4px;
    background: var(--accent);
    opacity: .8;
    position: relative;
    min-width: 4px;
    display: flex;
    align-items: center;
    padding: 0 .5rem;
    white-space: nowrap;
    overflow: hidden;
    font-size: .6875rem;
    color: #fff;
    font-weight: 600;
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
    min-height: 32px;
}

.timeline-label {
    width: 200px;
    flex-shrink: 0;
    font-size: .8125rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-track {
    flex: 1;
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
}

.timeline-today-line {
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: #ef4444;
    opacity: .7;
    z-index: 5;
}

/* ============================================================
   Modals
   ============================================================ */
.modal-content {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ============================================================
   Alerts / Flashes
   ============================================================ */
.alert {
    border-radius: 8px;
    font-size: .875rem;
    padding: .75rem 1rem;
    border: 1px solid transparent;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: .4;
}

.empty-state-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: .5rem;
}

/* ============================================================
   Activity Feed
   ============================================================ */
.activity-item {
    display: flex;
    gap: .875rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: .875rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: .8125rem;
    flex-shrink: 0;
}

/* ============================================================
   Table
   ============================================================ */
.table {
    font-size: .875rem;
    color: var(--text-primary);
}

.table th {
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: .625rem 1rem;
}

.table td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.auth-logo-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.125rem;
}

.auth-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: .375rem;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: .875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* ============================================================
   Color Picker
   ============================================================ */
.color-swatch {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-block;
    transition: transform .1s, border-color .1s;
}

.color-swatch.selected, .color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--text-primary);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content-inner {
        padding: 1rem 1.25rem;
    }

    .kanban-board {
        flex-wrap: nowrap;
    }
}

/* ============================================================
   Misc Utilities
   ============================================================ */
.text-muted { color: var(--text-secondary) !important; }
.border-accent { border-color: var(--accent) !important; }
.bg-accent-light { background-color: var(--accent-light) !important; }
.rounded-lg { border-radius: var(--radius) !important; }

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.overdue-indicator { color: #dc2626; }

.milestone-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

.milestone-dot.reached {
    background: #22c55e;
}
