html, body {
    margin: 0;
    height: 100%;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #f6f7f9;
    color: #222;
}

.app-nav {
    height: 2.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 0.75rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.app-nav a {
    color: #555;
    text-decoration: none;
}

.app-nav a.active {
    color: #1a73e8;
    font-weight: 600;
}

.nav-logout {
    margin-left: auto;
}

/* Two-column layout */
.admin-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 2.25rem);
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid #e0e0e0;
}

.panel:last-child {
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.panel-subtitle {
    font-weight: 400;
    color: #666;
    font-size: 0.9rem;
}

.panel-header .btn {
    margin-left: auto;
}

.panel-body {
    overflow-y: auto;
    flex: 1;
}

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

th, td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e6e6e6;
    font-size: 0.875rem;
    text-align: left;
    white-space: nowrap;
}

td.wrap {
    white-space: normal;
}

th {
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.col-num {
    text-align: right;
    width: 4rem;
}

.col-actions {
    width: 5rem;
    text-align: right;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: #f0f4ff;
}

tbody tr.selected {
    background: #e8f0fe;
}

/* Buttons */
.btn {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn-primary {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #1557b0;
}

.btn-danger {
    background: #d32f2f;
    border-color: #d32f2f;
    color: #fff;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-icon {
    padding: 0.2rem 0.45rem;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-left: 0.25rem;
}

.btn-icon:hover {
    background: #f0f0f0;
}

.btn-icon.danger:hover {
    background: #fde8e8;
    border-color: #d32f2f;
    color: #d32f2f;
}

/* Empty state */
.empty-msg {
    padding: 1rem 0.75rem;
    color: #777;
    font-style: italic;
    font-size: 0.875rem;
    margin: 0;
}

/* Dialogs */
dialog {
    border: none;
    border-radius: 8px;
    padding: 1.5rem;
    width: 360px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

dialog h2 {
    margin: 0 0 1.1rem 0;
    font-size: 1.05rem;
}

dialog label {
    display: block;
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 0.75rem;
}

dialog input,
dialog select,
dialog textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.2rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}

dialog textarea {
    resize: vertical;
}

.field-row {
    display: flex;
    gap: 0.75rem;
}

.field-row label {
    flex: 1;
    min-width: 0;
}

.dialog-error {
    color: #c5221f;
    font-size: 0.85rem;
    min-height: 1.1em;
    margin: 0 0 0.75rem 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

#confirm-dialog {
    width: 300px;
}

#confirm-dialog p {
    margin: 0 0 1.25rem 0;
    font-size: 0.95rem;
}
