@font-face {
    font-family: "Fira Mono Local";
    src: local("Fira Mono"), local("FiraMono-Regular");
    font-weight: 400;
}

:root {
    /* Defaults */
    font-family: "Fira Mono Local", "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-synthesis: none;
    color: #ccc;
    background: #181818;

    --bg: #181818;
    --input: #191919;
    --panel: #202020;
    --panel-alt: #252525;
    --border: #343434;
    --border-strong: #464646;
    --text: #cccccc;
    --text-strong: #e2e2e2;
    --text-dark: #101010;
    --muted: #858585;
    --blue: #4d9bd8;
    --blue-soft: #29465d;
    --danger: #c86a6a;
    --focus: #75bfff;

    --state-not-ok: #ff5757;
    --state-sometimes-ok: #ffa857;
    --state-ok: #57ff73;
    --state-unsure: #e2e2e2;
    --state-might-try: #9257ff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible {
    outline: 1px solid var(--focus);
    outline-offset: 1px;
}

.button-danger:focus-visible {
    outline-color: var(--danger);
}

.app-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 24px;
}

.app-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    /* Divider */
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.header-title {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.header-title-text {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    color: var(--text-strong);
}

.header-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.header-actions,
.panel-actions {
    margin: 0;
    align-items: center;
    gap: 6px;
}

.button,
.icon-button {
    border: 1px solid var(--border-strong);
    background: var(--panel);
    cursor: pointer;
}

.button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 15px;
}

.icon-button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    color: var(--text);
}

.button:hover,
.icon-button:hover {
    background: var(--panel-alt);
}

.button-primary {
    border-color: var(--blue);
    background: var(--blue);
    color: var(--text-dark);
}

.button-primary:hover {
    background: color-mix(in srgb, var(--blue) 90%, #fff 10%);
}

.button-secondary {
    color: var(--text);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 16px;
    align-items: start;
}

.panel {
    border: 1px solid var(--border);
    background: var(--panel);
    height: fit-content;
}

.panel-header {
    min-height: 48px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.panel-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-strong);
}

.panel-count {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.text-input {
    min-height: 30px;
    background: var(--input);
    border: 1px solid var(--border-strong);
    padding: 0 8px;
    color: var(--text);
    flex-grow: 1;
    font-size: 15px;
}

.text-input::placeholder {
    color: var(--muted);
}

.text-input:focus,
.button:focus,
.icon-button:focus {
    outline: 1px solid var(--blue);
    outline-offset: 1px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.item-name {
    height: 32px;
    margin: 0;
    padding: 0 10px;
    font-size: 14px;
    align-content: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: transparent;
    border: none;
    color: var(--text);
    width: 100%;
}


.item-controls {
    display: flex;
}

.item-button {
    border: none;
    border-left: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
    min-height: 32px;
    padding: 0 8px;
    align-content: center;
    background: transparent;
}

/* Temporarily disabled for .item-state */
.item-button:hover:not(.item-state) {
    background: var(--panel-alt);
}

.item-name:focus,
.item-button:focus {
    outline-offset: -1px;
}

.edit-item-name {
    background: var(--bg);
}

.item-state {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    text-align: left;
    font-size: 12px;
    min-width: 132px;
    padding: 0 12px;
}

.item-state::before {
    content: "●";
    font-size: 13px;
    margin-right: 8px;
    color: var(--muted);
}

.item-state[data-state="not-ok"]::before {
    color: var(--state-not-ok);
}

.item-state[data-state="not-ok"] {
    background: color-mix(in srgb, var(--state-not-ok) 5%, transparent 95%);
}

.item-state[data-state="sometimes-ok"]::before {
    color: var(--state-sometimes-ok);
}

.item-state[data-state="sometimes-ok"] {
    background: color-mix(in srgb, var(--state-sometimes-ok) 5%, transparent 95%);
}

.item-state[data-state="ok"]::before {
    color: var(--state-ok);
}

.item-state[data-state="ok"] {
    background: color-mix(in srgb, var(--state-ok) 5%, transparent 95%);
}

.item-state[data-state="unsure"]::before {
    color: var(--state-unsure);
}

.item-state[data-state="unsure"] {
    background: color-mix(in srgb, var(--state-unsure) 5%, transparent 95%);
}

.item-state[data-state="might-try"]::before {
    color: var(--state-might-try);
}

.item-state[data-state="might-try"] {
    background: color-mix(in srgb, var(--state-might-try) 5%, transparent 95%);
}

.item-edit,
.item-delete {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.item-edit {
    color: var(--text-strong);
}

.button-danger {
    color: var(--danger);
}

.button-danger:focus {
    outline-color: var(--danger);
}

.empty-state {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    gap: 6px;
}

.empty-state-mark {
    font-size: 24px;
}

.empty-state-text,
.empty-state-hint {
    margin: 0;
    font-size: 12px;
}

.empty-state-text {
    color: var(--text);
}

.sidebar {
    display: grid;
    grid-template-rows: 2fr;
    gap: 16px;
}

.preset-list,
.saved-list {
    display: flex;
    flex-direction: column;
}

.list-preset,
.list-save {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-preset:not(:last-child),
.list-save:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.preset-button,
.save-button {
    border: none;
    background: transparent;
    cursor: pointer;
    height: 32px;
    width: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.save-button:not(:last-child) {
    border-right: 1px solid var(--border);
}

.save-button:hover {
    background: var(--panel-alt);
}

.save-button:focus {
    outline-offset: -1px;
}

.preset-information,
.save-information {
    padding: 0 20px 0 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    min-height: 32px;
    align-items: start;
}

.preset-name,
.save-name {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 100%;
    text-align: left;
    font-size: 12px;
    color: var(--text);
    margin-left: 10px;
}

.preset-item-count,
.save-item-count {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 100%;
    text-align: left;
    font-size: 10px;
    color: var(--muted);
    margin-left: 10px;
}

.edit-save-name {
    padding: 8px 10px;
    border: none;
    border-right: 1px solid var(--border);
}

.edit-save-name:focus {
    outline-offset: -1px;
}

/* Preset list (TODO) */

.empty-placeholder {
    padding: 8px 10px;
}

.empty-placeholder-text {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.dialog {
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.25);
}

.dialog-form {
    display: flex;
    flex-direction: column;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 8px 10px;
}

.dialog-title {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    color: var(--text);
}

.field-label {
    width: 100%;
    padding: 0 10px 2px 10px;
    font-size: 13px;
    color: var(--muted);
}

.field {
    margin: 0 10px;
}

#share-url {
    min-width: 340px;
    resize: none;
    overflow: hidden;
    padding: 8px;
    align-content: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.checkbox-label {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    padding: 2px 10px 0 10px;
    color: var(--text);
    font-size: 14px;
}

input[type="checkbox"] {
    margin: 0;
    max-height: 14px;
}

.dialog-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
}

.toast {
    position: fixed;
    margin: 0 8px 0 auto;
    text-align: right;
    bottom: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    outline: none;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none;
}

@media (max-width: 800px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .sidebar {
        grid-template-columns: 1fr;
    }

    .header-subtitle {
        display: none;
    }
}