:root {
    --bg: #f6f7f9;
    --ink: #17202a;
    --muted: #657080;
    --line: #dde3ea;
    --brand: #146c63;
    --brand-dark: #0f514b;
    --sidebar: #2c3138;
    --sidebar-dark: #252a31;
    --sidebar-active: #44484f;
    --surface: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    min-height: 82px;
    background: var(--brand);
    color: #ffffff;
    padding: 14px 32px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--brand);
    overflow: hidden;
    font-weight: 800;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.brand-block h1 {
    font-size: 24px;
}

.app-header .eyebrow {
    color: #d6f3ee;
}

.workspace {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: calc(100vh - 82px);
}

.sidebar {
    background: var(--sidebar);
    color: #ffffff;
}

.side-menu {
    position: sticky;
    top: 82px;
    display: grid;
    gap: 12px;
    padding: 16px 0 28px;
}

.side-link,
.submenu a {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.side-link {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    border-left: 5px solid transparent;
    padding: 0 26px 0 30px;
    font-size: 16px;
}

.side-link:hover,
.side-link.active {
    border-left-color: var(--brand);
    background: var(--sidebar-active);
}

.group-label {
    cursor: default;
}

.menu-icon {
    position: relative;
    width: 22px;
    height: 22px;
}

.dashboard-icon::before {
    content: "";
    position: absolute;
    inset: 2px;
    background:
        linear-gradient(#fff 0 0) left top / 8px 8px no-repeat,
        linear-gradient(#fff 0 0) right top / 8px 8px no-repeat,
        linear-gradient(#fff 0 0) left bottom / 8px 8px no-repeat,
        linear-gradient(#fff 0 0) right bottom / 8px 8px no-repeat;
}

.request-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 14px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 2px;
}

.request-icon::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 8px;
    width: 10px;
    height: 2px;
    background: #fff;
    box-shadow: 0 5px 0 #fff;
}

.chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(45deg);
}

.submenu {
    display: grid;
    gap: 8px;
    margin: 0 0 4px 58px;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    padding: 8px 0 8px 26px;
}

.submenu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    border-radius: 6px;
    padding: 0 16px;
    margin-right: 10px;
    color: #f3f5f7;
    font-size: 14px;
}

.submenu a:hover,
.submenu a.active {
    background: var(--sidebar-active);
}

.content-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 28px 28px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 22px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 32px;
}

h2 {
    margin-bottom: 0;
}

.button {
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--brand-dark);
}

.button.secondary {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

.button.secondary:hover {
    background: #eef3f6;
}

.button.compact {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.button.danger {
    background: #b42318;
}

.button.danger:hover {
    background: #8f1d15;
}

.button.disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metrics article,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.metrics article {
    min-height: 104px;
    padding: 18px;
}

.metrics span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
}

.metrics strong {
    font-size: 30px;
}

.panel {
    padding: 20px;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 0.9fr);
    align-items: start;
    gap: 24px;
}

.form-layout > .panel {
    border-top: 4px solid #111827;
}

.guide-panel {
    position: sticky;
    top: 106px;
}

.guide-panel h3 {
    margin: 0 0 18px;
    font-size: 22px;
}

.guide-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding-left: 20px;
    color: #374151;
    line-height: 1.45;
}

.guide-list li::marker {
    color: var(--brand);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-head.compact {
    align-items: center;
    margin-bottom: 10px;
}

.section-head h2,
.section-head h3,
.section-head p {
    margin-bottom: 0;
}

.empty,
.notice {
    border-radius: 8px;
    padding: 14px 16px;
}

.empty {
    border: 1px dashed var(--line);
    color: var(--muted);
}

.notice {
    margin-bottom: 16px;
    font-weight: 700;
}

.notice.success {
    border: 1px solid #b9dfcf;
    background: #e9f7f1;
    color: #0e6245;
}

.notice.danger {
    border: 1px solid #f0b8b8;
    background: #fff0f0;
    color: #9f2d2d;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table-actions {
    display: grid;
    gap: 8px;
    min-width: 210px;
}

.status-update-form {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) auto;
    gap: 8px;
}

.status-update-form select {
    min-height: 34px;
    padding: 6px 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td a {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: #e7f3f1;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
}

.form-stack {
    display: grid;
    gap: 24px;
}

.form-section {
    border-top: 1px solid var(--line);
    padding-top: 22px;
}

.form-section.first {
    border-top: 0;
    padding-top: 0;
}

.form-section h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    min-height: 42px;
    padding: 10px 11px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(20, 108, 99, 0.12);
}

.status-field {
    position: relative;
}

.status-select {
    position: relative;
}

.status-trigger,
.status-options button {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.status-trigger {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
}

.status-trigger:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(20, 108, 99, 0.12);
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.status-request {
    background: #e3342f;
}

.status-process {
    background: #f59e0b;
}

.status-done {
    background: #16a34a;
}

.status-arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    margin-top: -4px;
}

.status-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    display: none;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.status-select.open .status-options {
    display: grid;
}

.status-select.open .status-arrow {
    transform: rotate(225deg);
    margin-top: 4px;
}

.status-options button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    border: 0;
    border-bottom: 1px solid #edf1f5;
    padding: 0 18px;
    cursor: pointer;
}

.status-options button:last-child {
    border-bottom: 0;
}

.status-options button:hover {
    background: #f4f7f9;
}

.span-2 {
    grid-column: span 2;
}

.item-list {
    display: grid;
    gap: 10px;
}

.item-row {
    display: grid;
    grid-template-columns: 1.5fr 0.7fr 0.6fr 1fr 1.2fr 38px;
    gap: 8px;
}

.icon-button {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: #9f2d2d;
    cursor: pointer;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-grid div,
.approval-list div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.detail-grid span,
.approval-list span,
.muted {
    color: var(--muted);
}

.detail-grid strong,
.approval-list strong {
    display: block;
    margin-top: 6px;
}

.approval-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.approval-list em {
    display: block;
    margin-top: 8px;
    color: var(--brand);
    font-style: normal;
    font-weight: 700;
}

.report-filter {
    margin-bottom: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: end;
    gap: 14px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.report-metrics strong {
    font-size: 24px;
}

.status-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.status-summary article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.status-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.status-summary strong,
.status-summary em {
    display: block;
    margin-top: 7px;
}

.status-summary em {
    color: var(--brand);
    font-style: normal;
    font-weight: 700;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.page-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.page-link:hover,
.page-link.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

code {
    color: var(--brand-dark);
    font-weight: 700;
}

@media (max-width: 760px) {
    .app-header {
        position: static;
        padding: 16px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .side-menu {
        position: static;
        gap: 4px;
        padding: 8px 0;
    }

    .side-link {
        min-height: 50px;
        font-size: 16px;
    }

    .submenu {
        margin-left: 58px;
    }

    .content-shell {
        padding: 20px 12px;
    }

    .form-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .guide-panel {
        position: static;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid,
    .detail-grid,
    .approval-list,
    .filter-grid,
    .status-summary {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .item-row {
        grid-template-columns: 1fr;
    }

    .icon-button {
        min-height: 38px;
    }

    .pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .page-list {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .metrics {
        grid-template-columns: 1fr;
    }

    .actions,
    .form-actions,
    .filter-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .button {
        width: 100%;
    }
}
