:root {
    --page: #eaf2fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #dbe3ed;
    --text: #263241;
    --muted: #7c8898;
    --nav: #0d255f;
    --nav-deep: #0a1d4c;
    --nav-active: #0e4795;
    --accent: #2f80ed;
    --accent-dark: #1764c8;
    --danger-bg: #fff1f0;
    --danger-border: #ffccc7;
    --danger-text: #a8071a;
    --shadow: 0 24px 70px rgba(24, 62, 109, 0.20);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: Arial, sans-serif;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 46%),
        var(--page);
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

button,
input,
input[type="file"],
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    width: 100%;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    background: var(--surface);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #103f87 0%, var(--nav-deep) 34%, #081943 100%);
    color: #dbe7f7;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 14px 14px 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #e75f5f;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.brand-text {
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.nav {
    display: grid;
    gap: 8px;
    padding: 22px 10px;
}

.nav-spacer {
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 7px;
    color: #b8c8e2;
    font-weight: 700;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--nav-active);
    color: #fff;
}

.nav-icon {
    width: 20px;
    text-align: center;
    color: inherit;
}

.main-area {
    min-width: 0;
    background: #f6f9fc;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-height: 68px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
}

.search {
    width: min(280px, 42vw);
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 11px 14px;
}

.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: #132f67;
    color: #fff;
    font-weight: 700;
}

.content {
    min-width: 0;
    padding: 24px;
}

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

.title-input {
    width: min(680px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
    padding: 12px 14px;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

.button:hover {
    text-decoration: none;
}

.button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button.primary:hover {
    background: var(--accent-dark);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
    gap: 24px;
}

.panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    font-size: 15px;
    color: var(--accent);
}

.panel-body {
    padding: 18px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
}

.tab {
    min-width: 100px;
    padding: 15px 22px;
    border-right: 1px solid var(--line);
    color: #687487;
    font-weight: 700;
}

.tab.active {
    color: var(--accent);
    background: #fff;
}

.editor-card {
    min-width: 0;
    margin: 14px;
    padding: 16px;
    background: #f9fbfd;
    border: 1px solid #edf2f7;
    border-radius: 8px;
}

.empty-state h2,
.editor-card h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.empty-state p,
.editor-card p {
    margin: 0;
    color: #5d6878;
    line-height: 1.55;
}

.muted {
    color: var(--muted);
}

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

.metric {
    display: grid;
    gap: 8px;
    min-height: 96px;
    align-content: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    font-size: 30px;
    line-height: 1;
}

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

.status-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.status-pill span {
    color: var(--muted);
    font-weight: 700;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

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

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.small-input {
    width: 74px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px 8px;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    padding: 0;
}

.text-button.danger {
    color: var(--danger-text);
}

.side-panel {
    display: grid;
    gap: 18px;
    align-content: start;
}

.field {
    display: grid;
    gap: 7px;
}

.field label {
    color: #647082;
    font-size: 14px;
    font-weight: 700;
}

.field input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
}

.form-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.form-panel h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.login-wrap {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(219, 227, 237, 0.95);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-card .brand {
    background: linear-gradient(90deg, #103f87, #0a1d4c);
}

.login-body {
    padding: 26px;
}

.login-body h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.login-body p {
    margin: 0 0 18px;
    color: var(--muted);
}

.form-field {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}

.form-field label {
    font-weight: 700;
}

.form-field input {
    width: 100%;
    border: 1px solid #b8c2cc;
    border-radius: 8px;
    font-size: 16px;
    padding: 11px 12px;
}

.form-field input[type="file"] {
    background: #fff;
    cursor: pointer;
}

.form-field select {
    width: 100%;
    border: 1px solid #b8c2cc;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    padding: 11px 12px;
}

.field-help {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.form-submit {
    width: 100%;
    margin-top: 22px;
}

.error {
    margin: 16px 0 0;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: 8px;
    color: var(--danger-text);
    padding: 10px 12px;
}

.notice {
    margin: 0 0 16px;
    background: #eefaf1;
    border: 1px solid #b7ebc6;
    border-radius: 8px;
    color: #116329;
    padding: 10px 12px;
}

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

.weekday-grid label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.help-tip {
    position: relative;
    display: inline-grid;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0;
    place-items: center;
    border: 1px solid #8ea1b7;
    border-radius: 50%;
    background: #eef3f8;
    color: #31465e;
    font: 700 12px/1 Arial, sans-serif;
    cursor: help;
    vertical-align: middle;
}

.help-tip::after {
    position: absolute;
    z-index: 100;
    left: 50%;
    bottom: calc(100% + 9px);
    width: 270px;
    padding: 10px 12px;
    border-radius: 7px;
    background: #182434;
    box-shadow: 0 8px 24px rgba(18, 31, 47, 0.22);
    color: #fff;
    content: attr(data-tooltip);
    font: 400 13px/1.45 Arial, sans-serif;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translate(-50%, 4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.help-section {
    margin-bottom: 22px;
}

.help-section h2 {
    margin-bottom: 8px;
}

.help-section li {
    margin-bottom: 7px;
    line-height: 1.5;
}

.landing {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.landing-panel {
    width: min(780px, 100%);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(219, 227, 237, 0.95);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.landing-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(90deg, #103f87, #0a1d4c);
    color: #fff;
}

.landing-body {
    padding: 28px;
}

.landing-body h1 {
    margin: 0 0 10px;
    font-size: 32px;
}

.landing-body p {
    color: #5d6878;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        width: 100%;
        margin: 0;
    }

    .sidebar {
        min-height: auto;
    }

    .nav {
        grid-auto-flow: column;
        overflow-x: auto;
        padding: 10px;
    }

    .nav-spacer {
        display: none;
    }

    .topbar {
        justify-content: space-between;
        padding: 14px 18px;
    }

    .content {
        padding: 20px;
    }

    .page-actions,
    .workspace-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .metric-grid,
    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .metric-grid,
    .status-grid {
        grid-template-columns: 1fr;
    }
}
