:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #18202a;
    --muted: #647083;
    --line: #dde3eb;
    --brand: #18705a;
    --brand-dark: #105643;
    --danger: #b42318;
    --ok: #137333;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
}

.brand img {
    display: block;
    width: auto;
    max-width: 180px;
    max-height: 54px;
}

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

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.site-footer {
    margin-top: 36px;
    padding: 22px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.site-footer a {
    color: var(--brand);
    font-weight: 700;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-action-form {
    display: inline-flex;
}

h1, h2 {
    margin: 0 0 16px;
    line-height: 1.2;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 20px;
    margin-top: 28px;
}

.auth-panel {
    width: min(420px, 100%);
    margin: 70px auto;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 600;
}

input, textarea, select {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

button:hover, .button:hover {
    background: var(--brand-dark);
    color: #fff;
}

form {
    display: grid;
    gap: 16px;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.grid-form .full {
    grid-column: 1 / -1;
}

.inline-form {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
    align-items: end;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.filter-form {
    display: grid;
    grid-template-columns: 180px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.calendar-filter {
    grid-template-columns: 40px 180px 40px minmax(220px, 1fr);
}

.month-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--brand-dark);
    font-size: 26px;
    font-weight: 700;
}

.month-arrow:hover {
    background: #edf4f1;
    color: var(--brand-dark);
}

.calendar {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.calendar-head,
.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-head > div {
    padding: 10px;
    background: #eef3f6;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    border-right: 1px solid var(--line);
}

.calendar-day {
    min-height: 124px;
    padding: 8px;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.calendar-day.empty {
    background: #f8fafc;
}

.calendar-day strong {
    display: block;
    margin-bottom: 6px;
}

.calendar-item {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
    padding: 6px;
    border-radius: 6px;
    background: #edf4f1;
    color: var(--brand-dark);
    font-size: 13px;
}

.calendar-item small {
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:nth-child(even) {
    background: #f5f5f5;
}

tbody tr:nth-child(odd) {
    background: #fff;
}

tbody tr:hover {
    background: #eef3f6;
}

.stats-grid, .info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.quick-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-weight: 700;
}

.quick-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.quick-card strong {
    font-size: 24px;
}

.quick-card.action-card {
    align-content: center;
    min-height: 74px;
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    text-align: center;
}

.quick-card.action-card:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.stat, .info-grid > div {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat span, .info-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat strong, .info-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
}

.badge, .status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.badge {
    background: #edf4f1;
    color: var(--brand-dark);
}

.status-planned {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-approved {
    background: #1d4ed8;
    color: #fff;
}

.status-pill.status-approved,
.calendar-item small .status-pill.status-approved,
.info-grid strong .status-pill.status-approved {
    background: #1d4ed8;
    color: #fff;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-refused {
    background: #fee2e2;
    color: #b91c1c;
}

.status-rescheduled {
    background: #fef3c7;
    color: #92400e;
}

.action-links {
    display: grid;
    gap: 3px;
    font-size: 13px;
    line-height: 1.25;
}

.action-links a {
    color: var(--brand-dark);
}

.action-links .danger-link {
    color: var(--danger);
}

.inline-delete-form {
    display: inline;
}

.inline-delete-form button {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--danger);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.inline-delete-form button:hover {
    background: transparent;
    color: var(--danger);
    text-decoration: underline;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}

.notice.success {
    border-color: #9bd4ad;
    color: var(--ok);
}

.notice.error {
    border-color: #f0aaa4;
    color: var(--danger);
}

.manual-section {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.manual-section h2 {
    margin-top: 0;
}

.manual-section p,
.manual-section ol,
.manual-section ul {
    margin-top: 0;
    margin-bottom: 0;
}

.manual-section li {
    margin-bottom: 7px;
}

.copy-box {
    overflow-x: auto;
    padding: 14px;
    background: #111827;
    color: #f9fafb;
    border-radius: 8px;
}

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

.reschedule-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    max-width: 320px;
}

.reschedule-form textarea {
    min-height: 64px;
}

.actions button {
    min-height: 34px;
    padding: 7px 10px;
}

@media (max-width: 760px) {
    .topbar, .page-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid-form, .inline-form, .filter-form, .stats-grid, .info-grid, .quick-grid {
        grid-template-columns: 1fr;
    }

    .calendar {
        overflow-x: auto;
    }

    .calendar-head,
    .calendar-week {
        min-width: 760px;
    }
}
