:root {
    --bg: #f4efe6;
    --panel: #fffaf1;
    --panel-2: #f8f0e2;
    --line: #d8ccb8;
    --text: #2f2418;
    --muted: #7d6852;
    --accent: #9c3f1f;
    --accent-2: #4f6f52;
    --focus: #c77800;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 700px at 95% 0%, #e2c8a0 0%, transparent 60%),
        linear-gradient(145deg, #f8f2e7 0%, var(--bg) 100%);
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    padding: 1.1rem 1.3rem 1rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 241, 0.8);
    backdrop-filter: blur(2px);
}

.topbar h1 {
    margin: 0;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
}

.topbar p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.file-button,
button {
    border: 1px solid var(--accent);
    color: #fff;
    background: var(--accent);
    padding: 0.48rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.file-button.secondary {
    border-color: var(--accent-2);
    background: var(--accent-2);
}

.file-button input {
    display: none;
}

button:hover,
.file-button:hover {
    filter: brightness(1.05);
}

button:focus-visible,
.file-button:focus-within {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.status {
    padding: 0.5rem 1.3rem;
    font-size: 0.88rem;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.layout {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
    gap: 1rem;
    padding: 1rem 1.3rem 1.3rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    min-height: 66vh;
    display: flex;
    flex-direction: column;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel-2);
}

.panel-head h2 {
    margin: 0;
    font-size: 1rem;
}

.filters {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

input[type="search"],
select,
input[type="number"],
input[type="text"] {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 0.45rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.85rem;
}

input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.table-wrap {
    overflow: auto;
    flex: 1 1 auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.83rem;
    vertical-align: middle;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: #fff2de;
}

tbody tr.selected {
    background: #f9dfbc;
}

.details-panel {
    overflow: hidden;
}

.details-body {
    padding: 0.8rem;
    overflow: auto;
}

.details-empty {
    padding: 1.1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.item-title {
    margin: 0;
    font-size: 1rem;
}

.badge {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.inline-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}

.placements-table th,
.placements-table td {
    font-size: 0.8rem;
    padding: 0.34rem 0.4rem;
}

.small-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 0.35rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.small-btn.remove {
    border-color: #b74a38;
    color: #8f2617;
}

.meta {
    margin: 0.7rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

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

    .panel {
        min-height: 45vh;
    }
}
