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

/* Author display rules (e.g. `.btn { display: inline-block }`,
   `button[data-icon] { display: inline-flex }`) outrank the UA's
   `[hidden] { display: none }`, silently un-hiding elements rendered with the
   hidden attribute. All visibility toggling in this app drives the attribute
   itself, so hidden must always win. */
[hidden] {
    display: none !important;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
}

/* Form controls don't inherit text styles — without this, fields fall back to
   the UA's black-on-white and become unreadable on dark themed surfaces.
   Element-level selectors, so any component class still overrides. */
input,
select,
textarea,
button {
    font-family: var(--font-body);
    color: var(--color-text);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
    background: var(--color-surface);
}

::placeholder {
    color: var(--color-text-muted);
}

.navbar {
    background: var(--color-navbar-bg);
    border-bottom: var(--border-width) solid var(--color-border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-navbar);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.navbar-brand {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    padding: 16px 0;
    margin-right: 30px;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 5px;
    flex: none;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 16px 16px;
    display: block;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-size: var(--font-size-base);
}

.nav-link:hover {
    color: var(--color-accent);
    background: var(--color-surface-hover);
}

.nav-link.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: 500;
}

.flash-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.alert-success {
    background: var(--color-success-soft);
    color: var(--color-success-soft-text);
    border: var(--border-width) solid var(--color-success-soft-border);
}

.alert-error {
    background: var(--color-danger-soft);
    color: var(--color-danger-soft-text);
    border: var(--border-width) solid var(--color-danger-soft-border);
}

.alert-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning-soft-text);
    border: var(--border-width) solid var(--color-warning-soft-border);
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0;
    margin-left: 15px;
    line-height: 1;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-container-layout {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 100px);
}

.page-header {
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header-main {
    flex: 1;
    min-width: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-heading);
    margin: 0 0 10px 0;
    color: var(--color-text);
}

.page-header .subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin: 0;
}

/* Radio Button Styles */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.radio-label:hover {
    color: var(--color-text);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--color-accent);
}

input[type="range"] {
    accent-color: var(--color-accent);
}

.radio-label span {
    user-select: none;
}