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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f1117;
    color: #e4e6eb;
    min-height: 100vh;
}

.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #171a23;
    border-bottom: 1px solid #2a2e3a;
}

.nav-brand { font-size: 1.2em; font-weight: 700; }

.nav-links a {
    color: #a8b0c0;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}
.nav-links a:hover { color: #fff; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}
.flash-error { background: #3a1c1c; color: #ff8080; border: 1px solid #6b2c2c; }
.flash-success { background: #1c3a24; color: #7ee08a; border: 1px solid #2c6b3c; }

.card {
    background: #171a23;
    border: 1px solid #2a2e3a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

h1 { font-size: 1.6em; margin-bottom: 16px; }
h2 { font-size: 1.2em; margin-bottom: 12px; }
h3 { font-size: 1.05em; margin-bottom: 8px; }

.auth-form {
    max-width: 380px;
    margin: 60px auto;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 0.9em;
    color: #a8b0c0;
    font-weight: 500;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="date"], select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #2a2e3a;
    background: #0f1117;
    color: #e4e6eb;
    font-size: 1em;
}

input[type="time"] {
    width: 50%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 2px solid #4a7bff;
    background: #17a2ff14;
    color: #e4e6eb;
    font-size: 1.15em;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
}
input[type="time"].has-value {
    border-color: #2a2e3a;
    background: #0f1117;
}

/* Native browser clock/calendar picker icons render dark by default —
   invert + brighten so they're visible against our dark theme. */
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    cursor: pointer;
}

.time-field-wrap {
    position: relative;
}

input:focus, select:focus { outline: none; border-color: #4a7bff; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

.checkbox-big {
    width: 26px !important;
    height: 26px !important;
    accent-color: #4a7bff;
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-row-big label { font-size: 1.05em; cursor: pointer; }

button, .btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: #4a7bff;
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-top: 16px;
}
button:hover, .btn:hover { background: #3a6aef; }
button.btn-secondary, .btn-secondary { background: #2a2e3a; }
button.btn-secondary:hover, .btn-secondary:hover { background: #3a3e4a; }
button.btn-danger, .btn-danger { background: #b02a37; }
button.btn-danger:hover, .btn-danger:hover { background: #90212c; }
button.btn-sm, .btn-sm { padding: 6px 12px; font-size: 0.85em; margin-top: 0; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

a.plain-link { color: #4a7bff; text-decoration: none; }
a.plain-link:hover { text-decoration: underline; }

.center-text { text-align: center; }
.muted { color: #7a8194; font-size: 0.9em; }

/* Dashboard specific */
.clock-in-row { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.clock-in-row select { flex: 1; min-width: 180px; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.summary-box {
    background: #171a23;
    border: 1px solid #2a2e3a;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.summary-box .value { font-size: 1.4em; font-weight: 700; margin-top: 4px; }
.summary-box .label { font-size: 0.8em; color: #a8b0c0; }

.active-session {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 5px solid;
}

.wp-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.session-timer { font-family: "SF Mono", Consolas, monospace; font-weight: 700; font-size: 1.1em; }

.workplace-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    background: #202430;
}

.history-entry {
    padding: 14px;
    border-radius: 10px;
    background: #171a23;
    border: 1px solid #2a2e3a;
    margin-bottom: 10px;
    border-left: 5px solid;
}
.history-entry .row1 { display: flex; justify-content: space-between; align-items: center; }
.history-entry .meta { font-size: 0.85em; color: #a8b0c0; margin-top: 4px; }

.view-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.view-tabs a {
    padding: 8px 16px;
    border-radius: 8px;
    background: #171a23;
    color: #a8b0c0;
    text-decoration: none;
    font-weight: 600;
}
.view-tabs a.active { background: #4a7bff; color: #fff; }

.period-card {
    border: 1px solid #2a2e3a;
}
.period-card .view-tabs a { background: #0f1117; }
.period-card .nav-date {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid #2a2e3a;
}

.entry-date-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f1117;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 1.05em;
}

.nav-date { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

.workplace-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: #0f1117;
    border-left: 4px solid;
    margin-bottom: 8px;
}

.workplace-box {
    background: #0f1117;
    border: 1px solid #2a2e3a;
    border-left: 4px solid;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
}
.workplace-box .wp-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.workplace-box .wp-fields > div { flex: 1; min-width: 110px; }
.workplace-box .wp-fields label {
    font-size: 0.8em;
    margin-top: 0;
}
.workplace-box .wp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #2a2e3a;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1c3a24;
    color: #7ee08a;
    border: 1px solid #2c6b3c;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1000;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a8b0c0;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 16px;
}
.back-link:hover { color: #fff; }

.nav-links-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.nav-links-row .back-link { margin-bottom: 0; }
