:root {
    color-scheme: light;
    --bg: #f3f5f7;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #64707d;
    --line: #d8dee6;
    --primary: #1f6b4f;
    --primary-dark: #174f3b;
    --sidebar: #243447;
    --sidebar-active: #1f6b4f;
    --danger-bg: #fff1f0;
    --danger-text: #9f2f24;
    --shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
    font-family: Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 440px);
}

.auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 32px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
}

.brand-kicker {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.form-message {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 10px;
}

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

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
}

select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

select {
    min-height: 38px;
    background: #ffffff;
}

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

input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(31, 107, 79, 0.16);
}

select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(31, 107, 79, 0.16);
}

button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}

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

button:disabled {
    cursor: progress;
    opacity: 0.76;
}

.button-loading {
    display: none;
}

.is-submitting .button-text {
    display: none;
}

.is-submitting .button-loading {
    display: inline;
}

.secondary-button {
    min-width: 104px;
    background: #eef3ef;
    color: var(--text);
}

.secondary-button:hover {
    background: #dfe8e1;
}

.compact-button {
    min-height: 34px;
    min-width: 86px;
    padding: 0 14px;
    font-size: 13px;
}

.oa-page {
    display: grid;
    grid-template-columns: 236px minmax(900px, 1fr);
    min-width: 1120px;
    background: var(--bg);
}

.oa-sidebar {
    min-height: 100vh;
    background: var(--sidebar);
    color: #ffffff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.oa-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 72px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.oa-brand strong,
.oa-brand span {
    display: block;
}

.oa-brand span {
    margin-top: 3px;
    color: #b9c4ce;
    font-size: 12px;
}

.oa-nav {
    display: grid;
    gap: 2px;
    padding: 12px;
}

.oa-nav a {
    display: block;
    min-height: 36px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #d9e2ea;
    font-size: 14px;
    text-decoration: none;
}

.oa-nav a:hover,
.oa-nav a.active {
    background: var(--sidebar-active);
    color: #ffffff;
}

.oa-main {
    min-height: 100vh;
}

.oa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.oa-header h1 {
    font-size: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    min-width: 190px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    text-align: right;
}

.user-chip span,
.user-chip small {
    display: block;
}

.user-chip span {
    font-size: 14px;
    font-weight: 700;
}

.user-chip small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.oa-content {
    display: grid;
    gap: 16px;
    padding: 18px 20px 24px;
}

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

.metric-card,
.oa-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 106px;
    padding: 16px;
}

.metric-card span,
.metric-card small {
    color: var(--muted);
    font-size: 13px;
}

.metric-card strong {
    display: block;
    margin: 9px 0 8px;
    font-size: 24px;
}

.work-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
}

.module-layout {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.module-layout.read-only {
    grid-template-columns: minmax(0, 1fr);
}

.oa-panel {
    overflow: hidden;
}

.module-form-panel {
    position: sticky;
    top: 18px;
}

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

.panel-header h2 {
    font-size: 15px;
}

.panel-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.record-form {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.form-row {
    display: grid;
    gap: 6px;
}

.record-form label {
    font-size: 12px;
}

.record-form input {
    min-height: 38px;
    font-size: 14px;
}

.save-button {
    margin-top: 4px;
}

.inline-message {
    margin: 12px 14px 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.inline-message[data-type="success"] {
    background: #edf8f1;
    color: #1f6b4f;
}

.inline-message[data-type="error"] {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf1f4;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f8fafb;
    color: #52606d;
    font-weight: 700;
}

tbody tr:hover {
    background: #eef7f2;
}

.empty-cell {
    height: 86px;
    color: var(--muted);
    text-align: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-pill.neutral {
    background: #eef2f5;
    color: #52606d;
}

@media (max-width: 900px) {
    .auth-panel {
        padding: 24px;
    }

    .oa-page {
        grid-template-columns: 220px minmax(760px, 1fr);
        min-width: 980px;
    }
}


/* Runtime layout fix: keep OA navigation fixed while module content scrolls. */
body.oa-page {
    height: 100vh !important;
    overflow: hidden !important;
}

.oa-page {
    height: 100vh !important;
    overflow: hidden !important;
}

.oa-sidebar {
    height: 100vh !important;
    overflow: hidden !important;
}

.oa-nav {
    max-height: calc(100vh - 72px) !important;
    overflow-y: auto !important;
}

.oa-main {
    display: flex !important;
    min-width: 0 !important;
    height: 100vh !important;
    min-height: 0 !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.oa-header {
    flex: 0 0 72px !important;
}

.oa-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}
