:root {
    --bg-main: #f4f7f6;
    --bg-container: #fff;
    --text-main: #333;
    --text-muted: #718096;
    --border-color: #cbd5e0;
    --color-primary: #2b6cb0;
    --color-primary-light: #ebf8ff;
    --color-primary-border: #bee3f8;
    --highlight-selected-bg: var(--color-primary-light);
    --highlight-selected-border: var(--color-primary);
    --highlight-selected-text: var(--color-primary);
    --calendar-cell-w: 36px;
    --calendar-cell-h: 36px;
    --calendar-label-h: 12px;
    --calendar-day-line-h: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 18px 24px 14px;
    background: var(--bg-container);
    border-bottom: 1px solid var(--border-color);
}

h1,
h2 {
    margin: 0;
    color: #1a365d;
}

h1 {
    font-size: 20px;
}

h2 {
    font-size: 15px;
}

.admin-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-weight: bold;
}

.admin-back-link {
    color: var(--color-primary);
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

.admin-back-link:hover {
    text-decoration: underline;
}

.admin-main {
    padding: 18px 24px 28px;
}

.admin-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.admin-tab {
    border: 1px solid var(--border-color);
    background: var(--bg-container);
    color: var(--text-main);
    padding: 6px 12px;
    cursor: pointer;
    font-weight: bold;
}

.admin-tab.is-active {
    border-color: var(--highlight-selected-border);
    background: var(--highlight-selected-bg);
    color: var(--highlight-selected-text);
}

.admin-panel {
    width: fit-content;
}

.admin-panel.is-hidden {
    display: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.save-status {
    color: var(--color-primary);
    font-weight: bold;
}

.admin-action {
    border: none;
    color: #fff;
    padding: 5px 11px;
    font-weight: bold;
    cursor: pointer;
}

.admin-save {
    background: #3182ce;
}

.admin-cancel {
    background: #e53e3e;
}

.admin-action.is-disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-table {
    border-collapse: collapse;
    background: var(--bg-container);
    border: 1px solid var(--border-color);
}

.settings-table th,
.settings-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}

.settings-table th {
    background: #edf2f7;
    color: var(--color-primary);
}

.settings-table input {
    width: 86px;
    border: 1px solid var(--border-color);
    padding: 4px 6px;
    text-align: right;
}

.clinic-settings-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.clinic-target-panel {
    width: 230px;
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    padding: 10px;
}

.target-title {
    color: var(--color-primary);
    font-weight: bold;
    margin-bottom: 6px;
}

.target-title:not(:first-child) {
    margin-top: 14px;
}

.target-section-title {
    color: var(--color-primary);
    font-weight: bold;
    margin: 12px 0 4px;
}

.check-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.check-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.check-item input {
    flex: 0 0 auto;
    margin: 0;
}

.target-reset-item {
    margin-bottom: 4px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 252px);
    gap: 12px;
}

.month-card {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
}

.month-title {
    padding: 6px 8px;
    background: #edf2f7;
    color: #1a365d;
    font-weight: bold;
    text-align: center;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid var(--border-color);
    width: var(--calendar-cell-w);
    height: var(--calendar-cell-h);
    text-align: center;
    padding: 0;
}

.calendar-table th {
    height: 22px;
    background: #f7fafc;
    color: var(--text-muted);
    font-size: 11px;
}

.calendar-day {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: grid;
    grid-template-rows: var(--calendar-day-line-h) var(--calendar-label-h);
    align-content: center;
    justify-items: center;
    gap: 0;
    font: inherit;
    min-width: var(--calendar-cell-w);
    min-height: var(--calendar-cell-h);
}

.calendar-day > span:first-child {
    line-height: var(--calendar-day-line-h);
}

.calendar-day.is-closed {
    background: #fff5f5;
    color: #c53030;
    font-weight: bold;
}

.calendar-day.is-partial {
    background: #fffbeb;
    color: #975a16;
    font-weight: bold;
}

.calendar-day-label {
    display: block;
    font-size: 10px;
    line-height: var(--calendar-label-h);
    white-space: nowrap;
    width: 100%;
    height: var(--calendar-label-h);
}

.calendar-empty {
    background: #f7fafc;
}
