* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f5f5;
    color: #222;
    font-family: Arial, Helvetica, sans-serif;
}

header {
    background: #151515;
    color: #fff;
    padding: 16px 24px;
}

h1 {
    margin: 0 0 14px;
    font-size: 32px;
}

nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

nav a {
    color: #fff;
    text-decoration: none;
    background: #2a2a2a;
    padding: 9px 12px;
    border-radius: 8px;
}

nav a:hover {
    background: #444;
}

main {
    max-width: 1200px;

    padding: 0 18px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px #0001;
}

.card.mini {
    margin-bottom: 0;
    box-shadow: none;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.metric {
    font-size: 30px;
    font-weight: 700;
}

.label {
    color: #666;
    font-size: 14px;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 8px;
    background: #fff;
}

textarea {
    min-height: 90px;
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

label {
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
}

.btn,
button {
    background: #151515;
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.btn.secondary,
button.secondary {
    background: #666;
}

.btn.danger,
button.danger {
    background: #9b1c1c;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    vertical-align: top;
}

th {
    background: #eee;
}

.muted {
    color: #777;
}

.notice {
    padding: 12px;
    border-radius: 8px;
    background: #fff8d8;
    border: 1px solid #e4ce73;
}

.error {
    padding: 12px;
    border-radius: 8px;
    background: #ffe0e0;
    border: 1px solid #d88;
}

.success {
    padding: 12px;
    margin-bottom: 16px;
    background: #e7ffe7;
    border: 1px solid #9bd69b;
    border-radius: 8px;
}

.thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.thumbs img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.inline {
    display: inline;
}

.small {
    font-size: 13px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.checkcell {
    width: 35px;
}

.split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.table-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    flex-wrap: wrap;
}

.table-head form {
    display: flex;
    gap: 10px;
    align-items: end;
}

.table-head label {
    margin: 0;
}

.table-head select {
    min-width: 150px;
}

.tight {
    margin-top: 16px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.checkline {
    font-weight: 400;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px;
    background: #fafafa;
}

.checkline input {
    width: auto;
    margin-right: 6px;
}

/* Edit item toolbar */

.sticky-actions {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 1px 3px #0001;
}

.bottom-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.notes-preview {
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 8px;
    word-break: break-word;
}

.notes-preview a {
    text-decoration: underline;
}

.scroll-buttons {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

.scroll-buttons button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 18px;
    padding: 0;
}

/* Mobile */

@media (max-width: 800px) {
    .split {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 14px;
    }

    .sticky-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .sticky-actions > div {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
}

.note-links {
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.note-links a {
    text-decoration: none;
    font-weight: 600;
}

.note-links a:hover {
    text-decoration: underline;
}
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 9999;
}

#toast.show {
    opacity: 1;
}
