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

body {
    height: 100vh;
    overflow: hidden;
    font-family: "Inconsolata", monospace;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: 14px;
    color: #ddd;
    background-color: #444;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

ul {
    margin-left: 1em;
    list-style-type: none;
}

#app-container {
    display: flex;
    height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
    background: #3a3a3a;
    border-right: 1px solid #555;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: auto;
    min-width: 0;
}

.sidebar.collapsed #tab-nav,
.sidebar.collapsed #sidebar-dates,
.sidebar.collapsed #sidebar-footer {
    display: none;
}

.sidebar.expanded {
    width: 16ch;
    min-width: 16ch;
}

#tab-nav {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #555;
}

.tab-link {
    display: block;
    padding: 0.4em 0.5em;
    color: #777;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-link:hover {
    color: #ddd;
    background: #4a4a4a;
}

.tab-link.active {
    color: #fff;
    background: #555;
}

.sidebar-toggle {
    padding: 0.3em 0.5em;
    color: #777;
    cursor: pointer;
    border-bottom: 1px solid #555;
    text-align: center;
}

.sidebar-toggle:hover {
    color: #ddd;
    background: #4a4a4a;
}

#sidebar-dates {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

#sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #555;
    position: relative;
}

.footer-settings {
    border-top: 1px solid #555;
}

.workspace-indicator {
    display: block;
    padding: 0.4em 0.5em;
    color: #777;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-indicator.clickable {
    cursor: pointer;
}

.workspace-indicator.clickable:hover {
    color: #ddd;
}

.workspace-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #333;
    border: 1px solid #555;
    border-bottom: none;
    max-height: 200px;
    overflow-y: auto;
}

.workspace-dropdown-item {
    padding: 0.4em 0.5em;
    color: #999;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-dropdown-item:hover {
    color: #ddd;
    background: #4a4a4a;
}

.workspace-dropdown-item.active {
    color: #fff;
    cursor: default;
    background: #555;
}

/* Date entries */
.sidebar-date {
    cursor: pointer;
    border-bottom: 1px solid #555;
    white-space: nowrap;
    background: #3a3a3a;
    transition: background .25s;
}

.sidebar-date.active {
    background: #555;
    color: #fff;
}

.sidebar-date:hover {
    background: #4a4a4a;
}

.sidebar-date.active:hover {
    background: #606060;
}

.sidebar-date.past {
    color: #999;
}

.sidebar-date-label {
    display: block;
    font-size: 0.9em;
    padding: .25em;
}

.sidebar-summary {
    display: block;
    font-size: 0.8em;
    color: #aaa;
    padding: 0 0 .5em 1em;
}

/* ── Main content ── */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.past-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 1em;
    border-bottom: 1px solid #555;
    background: #3a3a3a;
}

.past-date-header.hidden {
    display: none;
}

.past-date-header .date-label {
    color: #999;
    font-size: 0.95em;
}

.past-date-header .unlock-link {
    color: #999;
    text-decoration: none;
    font-size: 0.9em;
}

.past-date-header .unlock-link:hover {
    color: #ddd;
}

input:disabled,
textarea:disabled {
    background-color: #3a3a3a !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

/* ── Time tracker ── */

#time-container {
    padding: 1em;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    flex: 1;
    overflow-y: auto;
}

.time-row {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.time-row input {
    border: 1px solid #555;
    padding: 0.25em;
}

.time-row input:focus {
    outline: none;
    border-color: #777;
}

.time-row .start,
.time-row .end {
    width: 9ch;
}

.time-row .total {
    width: 7ch;
    display: inline-block;
    text-align: center;
}

.time-row .project {
    width: 30ch;
}

.time-row .notes {
    width: 100%;
}

/* ── Todo ── */

#the-textarea {
    padding: 1em;
    width: 100%;
    flex: 1;
    border: none;
    resize: none;
    text-wrap: nowrap;
}

#the-textarea:focus {
    outline: none;
}

/* ── Summary ── */

.summary-container {
    padding: 1em;
    flex: 1;
    overflow-y: auto;
}

.summary-controls {
    display: flex;
    gap: 2em;
    align-items: center;
    margin-bottom: 1.5em;
}

.window-option {
    color: #999;
    cursor: pointer;
    padding: 0.2em 0.5em;
    text-decoration: none;
}

.window-option:hover {
    color: #ddd;
}

.window-option.active {
    color: #fff;
    border-bottom: 1px solid #fff;
}

.decay-display {
    color: #777;
    font-size: 0.9em;
}

.summary-table {
    margin-bottom: 2em;
}

.summary-row {
    display: flex;
    padding: 0.15em 0;
}

.summary-row.header {
    color: #777;
    margin-bottom: 0.25em;
}

.summary-row.separator {
    color: #555;
    overflow: hidden;
    margin: 0.25em 0;
}

.summary-row.total {
    color: #fff;
    margin-top: 0.25em;
}

.col-project {
    min-width: 20ch;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-weighted,
.col-raw,
.col-hours {
    min-width: 8ch;
    text-align: right;
}

.col-wpct,
.col-rpct {
    min-width: 6ch;
    text-align: right;
    color: #aaa;
}

.daily-row {
    display: flex;
    padding: 0.15em 0;
}

.col-date {
    min-width: 20ch;
    color: #999;
}

.daily-row.today .col-date {
    color: #ddd;
}

/* ── Settings ── */

.settings-container {
    padding: 1em;
    flex: 1;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 2em;
}

.settings-header {
    color: #777;
    margin-bottom: 0.5em;
}

.settings-separator {
    color: #555;
    overflow: hidden;
    margin-bottom: 0.75em;
}

.workspace-list {
    margin-bottom: 1em;
}

.workspace-entry {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.3em 0;
}

.workspace-name {
    min-width: 15ch;
}

.workspace-active-badge {
    color: #777;
    font-size: 0.9em;
}

.workspace-actions {
    display: flex;
    gap: 1em;
}

.workspace-action {
    color: #999;
    cursor: pointer;
    font-size: 0.9em;
    background: transparent;
    border: none;
    padding: 0;
}

.workspace-action:hover {
    color: #ddd;
}

.workspace-action.danger {
    color: #c66;
}

.workspace-action.danger:hover {
    color: #e88;
}

.new-workspace-row {
    display: flex;
    gap: 0.5em;
    align-items: center;
    margin-top: 0.5em;
}

.settings-input {
    background: #3a3a3a;
    border: 1px solid #555;
    padding: 0.3em 0.5em;
}

.settings-input:focus {
    outline: none;
    border-color: #888;
}

.settings-btn {
    background: #3a3a3a;
    border: 1px solid #555;
    color: #999;
    padding: 0.3em 0.75em;
    cursor: pointer;
}

.settings-btn:hover {
    color: #ddd;
    border-color: #888;
}

.decay-slider-row {
    display: flex;
    align-items: center;
    gap: 1em;
}

.decay-label {
    color: #999;
    min-width: 12ch;
}

.decay-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 4px;
    background: #555;
    outline: none;
    border-radius: 2px;
}

.decay-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #ddd;
    border-radius: 50%;
    cursor: pointer;
}

.decay-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #ddd;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.decay-value {
    min-width: 4ch;
}

/* ── Login ── */

.login-container {
    margin: auto;
    text-align: center;
}

.login-title {
    color: #777;
    font-weight: 400;
    margin-bottom: 2em;
}

.login-actions {
    display: flex;
    gap: 1em;
    justify-content: center;
}

.login-actions a {
    text-decoration: none;
}
