/* ═══════════════════════════════════════════════════════════
   Stechuhr — Weeklydealz Zeiterfassung
   Clean Industrial Design · Mobile-First
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg:         #0f1117;
    --bg-card:    #181b24;
    --bg-hover:   #1e2230;
    --bg-input:   #12141c;
    --border:     #2a2e3a;
    --border-light: #353946;

    --text:       #e8eaf0;
    --text-dim:   #8b8fa4;
    --text-muted: #5c6078;

    --accent:     #4f8cff;
    --accent-dim: #3a6ed4;
    --green:      #34d399;
    --green-dim:  #166534;
    --yellow:     #fbbf24;
    --yellow-dim: #713f12;
    --red:        #f87171;
    --red-dim:    #7f1d1d;
    --blue:       #60a5fa;
    --purple:     #a78bfa;

    --radius:     10px;
    --radius-sm:  6px;
    --shadow:     0 2px 12px rgba(0,0,0,0.3);
    --transition: 150ms ease;

    --font:       'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Reset & Base ──────────────────────────────────────── */

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

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

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

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

/* ─── Navbar ────────────────────────────────────────────── */

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon { font-size: 1.4rem; }
.brand-text { letter-spacing: -0.02em; }

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.87rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: rgba(79,140,255,0.1); }
.nav-icon { font-size: 1rem; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    padding: 0.3rem 0.6rem;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.mobile-toggle {
    display: none;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* ─── Container ─────────────────────────────────────────── */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

/* ─── Page Header ───────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.header-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.live-clock {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.04em;
}

.header-date {
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* ─── Status Card ───────────────────────────────────────── */

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.status-card.status-arbeitet { border-color: var(--green); border-left: 4px solid var(--green); }
.status-card.status-pause { border-color: var(--yellow); border-left: 4px solid var(--yellow); }
.status-card.status-feierabend { border-color: var(--blue); border-left: 4px solid var(--blue); }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.status-dot.pulse {
    animation: pulse 2s infinite;
}

.pause-dot { background: var(--yellow); }
.done-dot { background: var(--blue); }
.off-dot { background: var(--text-muted); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.status-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.detail-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
}

.detail-highlight .detail-value {
    color: var(--accent);
    font-size: 1.25rem;
}

/* ─── Action Buttons ────────────────────────────────────── */

.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn-action {
    flex: 1;
    min-width: 140px;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.btn-kommen {
    background: var(--green);
    color: #0a2010;
}
.btn-kommen:hover { background: #2cc584; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(52,211,153,0.3); }

.btn-gehen {
    background: var(--red);
    color: #1a0808;
}
.btn-gehen:hover { background: #ef5757; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(248,113,113,0.3); }

.btn-pause {
    background: var(--yellow);
    color: #1a1508;
}
.btn-pause:hover { background: #f0b311; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(251,191,36,0.3); }

.btn-icon { font-size: 1.1rem; }

/* ─── Stats Grid ────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stats-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: all var(--transition);
}

.stat-link { cursor: pointer; text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-unit {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.stat-warn { border-color: var(--red); }
.stat-warn .stat-value { color: var(--red); }

.stat-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.stat-bar-fill.bar-over { background: var(--red); }

/* ─── Cards ─────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-header-actions {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 1.25rem 0;
}

.card-header .card-title { padding: 0; }

/* ─── Tables ────────────────────────────────────────────── */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.data-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.row-weekend { opacity: 0.45; }
.row-urlaub { background: rgba(96,165,250,0.06) !important; }
.row-feiertag { background: rgba(251,191,36,0.06) !important; }
.row-total { background: var(--bg) !important; }
.row-total td { border-top: 2px solid var(--border-light); font-weight: 600; }
.row-inactive { opacity: 0.5; }
.row-warning { background: rgba(248,113,113,0.06) !important; }

.td-bold { font-weight: 600; font-family: var(--font-mono); }
.td-urlaub { font-weight: 500; color: var(--blue); }
.td-feiertag { font-weight: 500; color: var(--yellow); }
.td-actions { white-space: nowrap; }

.td-display {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* ─── Badges ────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-green { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-yellow { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-blue { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-red { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-grey { background: rgba(139,143,164,0.15); color: var(--text-dim); }
.badge-purple { background: rgba(167,139,250,0.15); color: var(--purple); }

/* ─── Buttons ───────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.87rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dim); color: white; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    padding: 0.4rem 0.6rem;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-danger:hover { color: var(--red) !important; }

.btn-sm { padding: 0.3rem 0.55rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* ─── Forms ─────────────────────────────────────────────── */

.form-card { padding: 1.5rem; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select {
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,140,255,0.15);
}

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

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.form-checkboxes {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-text {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group { flex: 1; min-width: 120px; }
.form-group-btn { flex: 0 !important; min-width: auto !important; }

.inline-form { padding: 0 1.25rem 1.25rem; }
.form-card .inline-form { padding: 0; }

/* ─── Edit Rows ─────────────────────────────────────────── */

.edit-row td { background: var(--bg); padding: 1rem; }

.edit-form { width: 100%; }

.edit-fields {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.edit-field label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.edit-field input { padding: 0.4rem 0.5rem; font-size: 0.82rem; width: 100px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); }
.edit-field-wide { flex: 1; }
.edit-field-wide input { width: 100%; }

.hidden { display: none !important; }

/* ─── Month Navigation ──────────────────────────────────── */

.month-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.month-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.month-label {
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 160px;
    text-align: center;
}

/* ─── Quick Links ───────────────────────────────────────── */

.quick-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.quick-link {
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.87rem;
    font-weight: 500;
    transition: all var(--transition);
}

.quick-link:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Flash Messages ────────────────────────────────────── */

.flash-container {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: opacity 0.3s;
    position: relative;
}

.flash-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); color: var(--green); }
.flash-error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: var(--red); }
.flash-warning { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25); color: var(--yellow); }
.flash-info { background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.25); color: var(--blue); }

.flash-close {
    margin-left: auto;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.5;
}

/* ─── Login Page ────────────────────────────────────────── */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-subtitle {
    color: var(--text-dim);
    font-size: 0.87rem;
    margin-top: 0.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form .btn { margin-top: 0.5rem; padding: 0.75rem; font-size: 1rem; }

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ─── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
    html { font-size: 14px; }

    .nav-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; }
    .nav-links { display: none; width: 100%; order: 3; flex-direction: column; padding-top: 0.5rem; }
    .nav-links.open { display: flex; }
    .nav-user { margin-left: auto; }
    .mobile-toggle { display: block; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .header-time { align-items: flex-start; }

    .stats-grid, .stats-3, .stats-4 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }

    .action-buttons { flex-direction: column; }
    .btn-action { min-width: 100%; }

    .form-row { flex-direction: column; }
    .form-row .form-group { min-width: 100%; }

    .status-details { flex-direction: column; gap: 0.75rem; }

    .edit-fields { flex-direction: column; }
    .edit-field input { width: 100%; }

    .td-display { flex-direction: column; gap: 0.35rem; }
}

@media (max-width: 480px) {
    .stats-grid, .stats-3, .stats-4 { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.5rem; }
    .live-clock { font-size: 1.5rem; }
    .month-label { min-width: auto; }
}

/* ─── 2FA Styles ────────────────────────────────────────── */

.input-2fa {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    text-align: center;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    width: 100%;
}

.input-2fa:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,140,255,0.15);
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setup-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.qr-container {
    margin-top: 0.75rem;
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    display: inline-block;
}

.qr-code {
    display: block;
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
}

.manual-key {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    word-break: break-all;
    user-select: all;
}

.verify-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.verify-form .form-group { flex: 1; min-width: 180px; }
.verify-form .input-2fa { font-size: 1.1rem; padding: 0.55rem 0.75rem; }

/* ─── Live Timer ────────────────────────────────────────── */

#live-timer {
    font-family: var(--font-mono);
    color: var(--green);
    animation: timer-glow 2s ease-in-out infinite;
}

@keyframes timer-glow {
    0%, 100% { text-shadow: 0 0 4px rgba(52,211,153,0.2); }
    50% { text-shadow: 0 0 12px rgba(52,211,153,0.4); }
}

/* ─── Pagination ────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* ─── Audit Row Highlights ──────────────────────────────── */

.row-admin-change {
    background: rgba(251,191,36,0.04) !important;
    border-left: 3px solid var(--yellow);
}
