* {
    box-sizing: border-box;
}

:root {
    --font-sans: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
    --color-primary: #E98A5A;
    --color-primary-dark: #D87444;
    --color-primary-soft: #FFF4EC;
    --color-success: #3FA66D;
    --color-info: #4C7ED9;
    --color-danger: #D85B5B;
    --color-warning: #B57A3F;
    --color-warning-bg: #FFF1E1;
    --color-danger-bg: #FDECEC;
    --color-success-bg: #EAF8F0;
    --color-info-bg: #EAF1FF;
    --color-black: #111111;
    --color-ink: #1f2933;
    --color-white: #ffffff;
    --color-page: #f4f6f8;
    --color-surface: #ffffff;
    --color-border: #e6e9ee;
    --color-border-strong: #cfd6df;
    --color-muted: #6b7280;
    --color-sidebar-bg: #0F2D3A;
    --color-sidebar-bg-soft: #16475A;
    --color-sidebar-text: #EAF4F8;
    --color-sidebar-accent: #7FC8E3;
    --shadow-soft: 0 12px 28px rgba(31, 41, 51, 0.07);
    --shadow-hover: 0 18px 38px rgba(31, 41, 51, 0.11);
    --radius-sm: 6px;
    --radius-md: 8px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-page);
    color: var(--color-ink);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--color-sidebar-bg) 0%, #0b2530 100%);
    color: var(--color-sidebar-text);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
    display: flex;
    align-items: center;
    font-weight: 800;
    margin-bottom: 18px;
    min-height: 42px;
    font-size: 1rem;
    color: var(--color-sidebar-text);
    letter-spacing: 0;
}

.menu {
    display: grid;
    gap: 5px;
}

.menu a {
    padding: 10px 11px;
    border-radius: var(--radius-sm);
    color: rgba(234, 244, 248, 0.86);
    font-weight: 650;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.menu a:hover,
.menu a.is-active {
    background: var(--color-sidebar-bg-soft);
    color: var(--color-sidebar-text);
}

.menu a.is-active {
    box-shadow: inset 3px 0 0 var(--color-sidebar-accent);
}

.menu-dropdown {
    display: block;
    width: 100%;
    border-radius: var(--radius-sm);
}

.menu-dropdown summary {
    list-style: none;
    padding: 10px 11px;
    border-radius: var(--radius-sm);
    color: rgba(234, 244, 248, 0.86);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 650;
    transition: background 0.16s ease, color 0.16s ease;
}

.menu-dropdown summary::-webkit-details-marker {
    display: none;
}

.menu-dropdown summary::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.menu-dropdown[open] summary::after {
    transform: rotate(225deg);
}

.menu-dropdown summary:hover,
.menu-dropdown[open] summary,
.menu-dropdown.is-active summary {
    background: var(--color-sidebar-bg-soft);
    color: var(--color-sidebar-text);
}

.menu-dropdown-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 5px 0 5px 12px;
}

.menu-dropdown-content a {
    display: block;
    width: 100%;
    padding: 8px 10px;
    color: rgba(234, 244, 248, 0.78);
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: normal;
}

.menu-dropdown-content a:hover {
    background: rgba(127, 200, 227, 0.16);
}

.content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(31, 41, 51, 0.06);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.topbar-user-name {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    max-width: min(360px, 45vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: var(--color-ink);
    font-size: 0.94rem;
    font-weight: 700;
    padding: 8px 12px;
}

.topbar-logout {
    margin: 0;
}

.page {
    width: min(1440px, 100%);
    padding: var(--space-6);
    margin: 0 auto;
}

.page > * + * {
    margin-top: var(--space-6);
}

.page > .page-head + .card,
.page > .page-head + .page-section {
    margin-top: var(--space-5);
}

h1 {
    margin: 0 0 16px;
    color: #17202a;
    font-size: 1.55rem;
    line-height: 1.15;
}

h2, h3 {
    margin-top: 0;
    color: #17202a;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: 0;
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.05);
}

.card-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.stats-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
    min-height: 122px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary-dark);
}

.report-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.report-edit-layout {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.report-edit-meta-card {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
}

.report-edit-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 0.92rem;
}

.report-edit-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.report-review-form {
    margin: 0;
}

.report-review-form .btn {
    min-height: 36px;
    padding: 8px 12px;
}

.report-edit-section {
    background: var(--color-white);
    border: 1px solid #d8dee8;
    border-radius: var(--radius-sm);
    box-shadow: 0 5px 14px rgba(31, 41, 51, 0.04);
    overflow: hidden;
}

.report-edit-summary {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 7px 12px 7px 14px;
    cursor: pointer;
    list-style: none;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.report-edit-summary::-webkit-details-marker {
    display: none;
}

.report-edit-title {
    color: #17202a;
    font-size: 0.92rem;
    font-weight: 800;
}

.report-edit-note {
    color: var(--color-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.report-edit-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    border-radius: 4px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 6px 10px;
    white-space: nowrap;
}

.report-edit-action::before {
    content: "+";
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.report-edit-section[open] .report-edit-summary {
    border-bottom: 1px solid var(--color-border);
    background: #f8fafc;
}

.report-edit-section[open] .report-edit-action::before {
    content: "-";
}

.report-edit-section[open] .report-edit-action {
    background: #fff7ed;
    border-color: #fed7aa;
    color: var(--color-primary-dark);
}

.report-edit-body {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: #fbfcfe;
}

.report-edit-body .grid-form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

.report-edit-body .grid-form textarea,
.report-edit-body .grid-form .muted {
    grid-column: 1 / -1;
}

.report-edit-body .grid-form .btn {
    width: auto;
    justify-self: start;
    align-self: end;
}

.report-edit-body .weather-form .btn {
    width: auto;
    min-width: 190px;
    justify-self: end;
    align-self: end;
}

.report-edit-items {
    display: grid;
    gap: 8px;
}

.report-edit-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.report-edit-item-data {
    display: grid;
    gap: 3px;
    font-size: 0.9rem;
    line-height: 1.35;
}

.report-edit-item-actions form {
    margin: 0;
}

.report-edit-item-actions .btn {
    min-height: 34px;
    padding: 7px 12px;
}

.weather-card {
    grid-column: 1 / -1;
}

.weather-form {
    display: grid;
    gap: 12px;
}

.weather-panel {
    display: grid;
    grid-template-columns: minmax(360px, 1.3fr) minmax(300px, 1fr) minmax(220px, 0.8fr);
    gap: 12px;
    align-items: start;
    max-width: 100%;
    overflow-x: auto;
}

.weather-table {
    display: grid;
    grid-template-columns: minmax(96px, 0.9fr) repeat(3, minmax(92px, 1fr));
    min-width: 440px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-white);
}

.weather-condition-table {
    grid-template-columns: minmax(96px, 0.9fr) repeat(2, minmax(110px, 1fr));
    min-width: 360px;
}

.weather-heading {
    grid-column: 1 / -1;
    padding: 9px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border-strong);
    font-weight: 700;
}

.weather-period,
.weather-period-label,
.weather-choice {
    min-height: 36px;
    padding: 8px 10px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
}

.weather-period,
.weather-period-label {
    font-weight: 700;
    background: #fbfbfb;
}

.weather-choice input,
.weather-period input {
    width: auto;
}

.weather-choice.is-disabled {
    color: #9ca3af;
    background: #f6f6f6;
    cursor: not-allowed;
}

.weather-choice.is-disabled input {
    cursor: not-allowed;
}

.weather-rain {
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--color-white);
    font-weight: 700;
    min-width: 220px;
}

.weather-rain input {
    margin-top: 6px;
    font-weight: 400;
}

.stat strong {
    display: block;
    margin-top: 8px;
    color: var(--color-primary-dark);
    font-size: 1.9rem;
    line-height: 1;
}

.stat h3 {
    margin-bottom: 0;
    color: var(--color-muted);
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-charts {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(420px, 1.35fr) minmax(320px, 0.9fr);
    align-items: stretch;
}

.chart-card {
    display: flex;
    flex-direction: column;
}

.chart-card h2 {
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.chart-card-featured {
    border-color: rgba(242, 107, 53, 0.42);
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 54%, #fff7f2 100%);
}

.chart-card-featured h2 {
    font-size: 1.35rem;
}

.pie-chart-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    flex: 1;
    min-height: 250px;
}

.pie-chart {
    width: clamp(210px, 24vw, 280px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(
        #F26B35 0 var(--slice-1),
        #dc2626 var(--slice-1) var(--slice-2),
        #16a34a var(--slice-2) 360deg
    );
    display: grid;
    place-items: center;
    position: relative;
    box-shadow: 0 18px 35px rgba(17, 17, 17, 0.12);
}

.pie-chart::after {
    content: "";
    width: 48%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--color-white);
    position: absolute;
    box-shadow: inset 0 0 0 1px var(--color-border);
}

.pie-chart span {
    position: relative;
    z-index: 1;
    font-weight: 800;
    font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.chart-legend {
    display: grid;
    gap: 10px;
    font-size: 0.98rem;
    min-width: 220px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.legend-warning { background: #F26B35; }
.legend-danger { background: #dc2626; }
.legend-success { background: #16a34a; }

.bar-chart {
    display: flex;
    align-items: end;
    justify-content: space-around;
    gap: 12px;
    min-height: 220px;
}

.bar-item {
    min-width: 68px;
    display: grid;
    gap: 6px;
    justify-items: center;
}

.bar-value {
    font-weight: 800;
}

.bar-track {
    width: 38px;
    height: 150px;
    border-radius: 999px;
    background: #f2f2f2;
    display: flex;
    align-items: end;
    overflow: hidden;
}

.bar-fill {
    width: 100%;
    border-radius: 999px 999px 0 0;
    background: var(--color-primary);
}

.bar-label {
    min-height: 34px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--color-muted);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 0;
}

.page-head h1 {
    margin-bottom: 0;
}

.page-section {
    display: grid;
    gap: var(--space-3);
}

.section-title {
    margin: 0;
    font-size: 1.16rem;
    font-weight: 800;
    color: #17202a;
}

.grid-form {
    display: grid;
    gap: 10px;
    align-items: start;
}

.grid-form.two-col {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 11px;
    font-size: 0.95rem;
    background: #fbfcfe;
    color: var(--color-ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(233, 138, 90, 0.16);
    background: var(--color-white);
    outline: none;
}

.select-option-create {
    color: var(--color-primary);
    font-weight: 700;
}

input[readonly] {
    background: #f3f4f6;
    color: var(--color-muted);
    cursor: default;
}

.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 38px;
    line-height: 1.2;
    align-self: center;
    flex: 0 0 auto;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
    letter-spacing: 0.01em;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

.btn-primary { background: var(--color-primary); color: var(--color-white); box-shadow: 0 8px 16px rgba(233, 138, 90, 0.2); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-light { background: var(--color-white); color: var(--color-ink); border: 1px solid var(--color-border-strong); }
.btn-light:hover { border-color: #b9c2cf; box-shadow: 0 8px 16px rgba(31, 41, 51, 0.08); }
.btn-danger { background: var(--color-danger); color: #fff; box-shadow: 0 7px 14px rgba(216, 91, 91, 0.16); }
.btn-view { background: #3E8A8C; color: #fff; box-shadow: 0 7px 14px rgba(62, 138, 140, 0.16); }
.btn-edit { background: var(--color-info); color: #fff; box-shadow: 0 7px 14px rgba(76, 126, 217, 0.17); }
.btn-approve { background: var(--color-success); color: #fff; box-shadow: 0 7px 14px rgba(63, 166, 109, 0.16); }
.btn-print { background: #8760D8; color: #fff; box-shadow: 0 7px 14px rgba(135, 96, 216, 0.16); }

.btn.btn-sm {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 0.82rem;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    align-self: start;
}

.grid-form > .actions {
    grid-column: 1 / -1;
    min-height: 0;
    height: auto;
}

.grid-form > .actions > .btn {
    width: auto;
    height: auto;
    min-height: 38px;
    align-self: center;
}

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

.actions-inline form {
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

.filter-row {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

.filter-panel {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border-color: #dce5f0;
}

.filter-row .btn {
    align-self: end;
    width: 100%;
    border-color: var(--color-border-strong);
    background: var(--color-white);
    color: var(--color-ink);
}

.filter-row .btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.filter-row button.btn {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 10px 18px rgba(242, 107, 53, 0.18);
}

.filter-row button.btn:hover {
    background: var(--color-primary-dark);
    color: var(--color-white);
}

.filter-row.search-row {
    grid-template-columns: minmax(240px, 1fr) auto auto;
}

.filter-row.search-row .btn {
    min-width: 108px;
    width: auto;
    padding-inline: 18px;
}

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

.works-table {
    min-width: 720px;
}

.responsive-table {
    min-width: 720px;
}

.works-table td,
.responsive-table td {
    overflow-wrap: anywhere;
}

.manual-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.28fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.manual-toc {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 8px;
}

.manual-toc strong {
    font-size: 0.95rem;
}

.manual-toc a {
    border-left: 3px solid transparent;
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 7px 8px;
}

.manual-toc a:hover {
    border-left-color: var(--color-primary);
    background: #fff7ed;
    color: var(--color-black);
}

.manual-content {
    display: grid;
    gap: 14px;
}

.manual-section {
    scroll-margin-top: 16px;
}

.manual-section h2 {
    margin-bottom: 8px;
    color: var(--color-primary-dark);
    font-size: 1.08rem;
}

.manual-section p {
    margin: 0 0 10px;
    line-height: 1.55;
}

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

.manual-section ul,
.manual-section ol {
    margin: 0 0 10px;
    padding-left: 22px;
    line-height: 1.55;
}

.manual-question {
    border-top: 1px solid var(--color-border);
    padding: 10px 0;
}

.manual-question:last-child {
    padding-bottom: 0;
}

.manual-question summary {
    cursor: pointer;
    font-weight: 700;
}

.manual-question p {
    margin-top: 8px;
    color: var(--color-muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

th, td {
    border-bottom: 1px solid var(--color-border);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

tbody tr:hover {
    background: #fffaf7;
}

.alert {
    border-radius: var(--radius-md);
    padding: 11px 13px;
    margin-bottom: 14px;
    font-weight: 700;
}

.alert.success {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid rgba(242, 107, 53, 0.3);
}

.alert.danger {
    background: #fee2e2;
    color: #991b1b;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(17, 17, 17, 0.9), rgba(17, 17, 17, 0.72)),
        radial-gradient(circle at 16% 18%, rgba(242, 107, 53, 0.36), transparent 32%),
        linear-gradient(135deg, #1d1d1d 0%, #343434 54%, #f26b35 100%);
    color: var(--color-white);
}

.auth-wrap {
    width: min(920px, 100%);
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.8fr);
    align-items: stretch;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(10px);
}

.auth-hero {
    min-height: 520px;
    padding: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    position: relative;
    overflow: hidden;
}

.auth-hero::before,
.auth-hero::after {
    content: "";
    position: absolute;
    inset: auto 34px 96px auto;
    width: 220px;
    height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transform: rotate(12deg);
}

.auth-hero::after {
    inset: auto 84px 48px auto;
    width: 160px;
    height: 160px;
    border-color: rgba(242, 107, 53, 0.5);
}

.auth-mark {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 14px 36px rgba(242, 107, 53, 0.36);
    position: relative;
    z-index: 1;
}

.auth-kicker {
    margin: 0 0 8px;
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-hero h1 {
    max-width: 420px;
    margin: 0;
    color: var(--color-white);
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1;
}

.auth-copy {
    max-width: 440px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    line-height: 1.6;
}

.auth-card {
    margin: 0;
    border: 0;
    border-left: 1px solid var(--color-border);
    border-radius: 0;
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: none;
}

.auth-card h2 {
    margin: 0 0 24px;
    font-size: 1.7rem;
}

.auth-form {
    gap: 14px;
}

.auth-form label {
    color: #374151;
    font-weight: 700;
}

.auth-form input {
    min-height: 46px;
    margin-top: 2px;
    background: #fbfbfb;
}

.auth-submit {
    width: 100%;
    min-height: 46px;
    margin-top: 8px;
    font-weight: 800;
}

.auth-link-row {
    display: flex;
    justify-content: flex-end;
    font-size: 0.9rem;
}

.auth-link-row-center {
    justify-content: center;
}

.auth-link-row a {
    color: var(--color-primary-dark);
    font-weight: 700;
}

.auth-link-row a:hover {
    text-decoration: underline;
}

.auth-secondary-form {
    margin-top: 10px;
}

.mobile-menu-btn {
    display: none;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.check input {
    width: auto;
}

.permission-check {
    align-items: flex-start;
}

.permission-text {
    display: grid;
    gap: 2px;
    line-height: 1.2;
}

.permission-text small {
    font-size: 0.76rem;
}

.fieldset-block {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    grid-column: 1 / -1;
}

.company-work-list {
    display: grid;
    gap: 10px;
}

.company-work-group {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.company-work-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    background: #fbfbfb;
    border-bottom: 1px solid var(--color-border);
}

.company-work-head strong {
    font-size: 0.94rem;
}

.company-work-group .check-grid {
    padding: 10px;
}

.company-work-toggle {
    display: inline-flex;
    width: auto;
    font-size: 0.84rem;
    color: var(--color-muted);
}

.permissions-block h3 {
    margin-bottom: 10px;
}

.permissions-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.permissions-toggle {
    display: inline-flex;
    width: auto;
    font-size: 0.84rem;
    color: var(--color-muted);
}

.permissions-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: start;
}

.permissions-sections {
    display: grid;
    gap: 14px;
}

.permission-section {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    background: #fbfcfe;
}

.permission-section h4 {
    margin: 0 0 10px;
    color: #17202a;
    font-size: 0.92rem;
}

.permissions-grid .permission-check {
    min-height: 42px;
}

.error {
    color: #b91c1c;
    min-height: 15px;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.status-badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.status-badge-danger {
    background: var(--color-danger-bg);
    color: #991b1b;
}

.status-badge-success {
    background: var(--color-success-bg);
    color: #166534;
}

.status-badge-info {
    background: var(--color-info-bg);
    color: #1e40af;
}

.status-badge-neutral {
    background: var(--color-info-bg);
    color: #1e3a8a;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.badge-info {
    background: var(--color-info-bg);
    color: #1e3a8a;
    border-color: #bfdbfe;
}

.badge-success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.line-item {
    padding: 7px 0;
    border-bottom: 1px dashed var(--color-border-strong);
    font-size: 0.9rem;
}

.signature-canvas {
    display: block;
    width: min(760px, 100%);
    height: 160px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    touch-action: none;
    background: var(--color-white);
}

.signature-form .signature-canvas,
.signature-form .actions-inline,
.signature-form .muted {
    grid-column: 1 / -1;
}

.signature-form .signature-canvas {
    justify-self: start;
}

.logo-preview img {
    max-height: 70px;
    max-width: 220px;
    object-fit: contain;
}

.table-logo {
    display: block;
    width: 90px;
    height: 48px;
    object-fit: contain;
}

.table-logo-cell {
    width: 110px;
    vertical-align: middle;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.pagination a {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-weight: 800;
}

.pagination a.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.print-logo {
    max-height: 90px;
}

.print-signature {
    max-width: 260px;
    max-height: 120px;
}

.print-photo {
    max-height: 260px;
}

.rdo-preview {
    overflow-x: auto;
    padding-bottom: 8px;
}

.rdo-print-body {
    min-height: 100vh;
    padding: 18px;
    background: #d9d9d9;
}

.rdo-print-toolbar {
    width: min(1080px, 100%);
    margin: 0 auto 10px;
    display: flex;
    justify-content: flex-end;
}

.rdo-document {
    width: min(1080px, 100%);
    min-width: 760px;
    margin: 0 auto 18px;
    padding: 14px;
    background: #fff;
    border: 1px solid #cfcfcf;
    box-shadow: 0 14px 34px rgba(17, 17, 17, 0.13);
    color: #111;
    font-size: 12px;
}

.rdo-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
}

.rdo-table th,
.rdo-table td {
    border: 1px solid #cfcfcf;
    padding: 7px 8px;
    vertical-align: top;
    font-size: 12px;
    line-height: 1.35;
    color: #111;
    word-break: break-word;
}

.rdo-table th {
    background: #f3f3f3;
    font-weight: 700;
}

.rdo-header-table th {
    width: 13%;
}

.rdo-brand-cell {
    height: 100px;
    text-align: center;
    vertical-align: middle !important;
}

.rdo-logo {
    display: block;
    max-width: 210px;
    max-height: 82px;
    object-fit: contain;
    margin: 0 auto;
}

.rdo-company-line {
    margin-top: 6px;
    color: #555;
    font-size: 11px;
}

.rdo-title-cell {
    text-align: center;
    font-size: 14px !important;
    background: #fff !important;
}

.rdo-section {
    margin-top: 14px;
    break-inside: avoid;
}

.rdo-quantity-grid td {
    width: 25%;
}

.rdo-qty-cell {
    min-height: 46px;
    text-align: center;
}

.rdo-qty-cell span,
.rdo-qty-cell strong,
.rdo-qty-cell small {
    display: block;
}

.rdo-qty-cell strong {
    margin-top: 2px;
    font-size: 14px;
}

.rdo-qty-cell small {
    margin-top: 2px;
    color: #555;
    font-size: 11px;
}

.rdo-blank {
    background: #fbfbfb;
}

.rdo-empty {
    height: 32px;
    color: #666 !important;
    font-style: italic;
    text-align: center;
}

.rdo-narrow {
    width: 150px;
}

.rdo-date-cell {
    width: 150px;
}

.rdo-user-cell {
    width: 170px;
}

.rdo-file-cell {
    width: 220px;
    text-align: center;
}

.rdo-file-cell .print-photo {
    display: block;
    max-width: 200px;
    max-height: 150px;
    object-fit: contain;
    margin: 0 auto;
}

.rdo-media-section .rdo-table td {
    padding: 9px 10px;
}

.rdo-media-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;
}

.rdo-media-item {
    width: calc((100% - 20px) / 6);
    min-width: 118px;
    margin: 0;
}

.rdo-media-item .print-photo,
.rdo-video-preview {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid #d5d5d5;
    object-fit: cover;
    background: #f5f5f5;
}

.rdo-media-open {
    cursor: zoom-in;
}

.rdo-media-open:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.rdo-media-item figcaption {
    margin-top: 3px;
    color: #444;
    font-size: 10px;
    line-height: 1.25;
}

.media-modal-open {
    overflow: hidden;
}

.media-modal[hidden] {
    display: none;
}

.media-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.media-modal-dialog {
    position: relative;
    display: grid;
    align-items: center;
    justify-items: center;
    width: 100%;
    height: 100%;
    padding: 54px 18px 24px;
}

.media-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 1;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 4px;
    background: rgba(17, 17, 17, 0.72);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.media-modal-content {
    display: grid;
    gap: 8px;
    justify-items: center;
    max-width: min(1080px, 96vw);
    max-height: 88vh;
}

.media-modal-media {
    display: block;
    max-width: 96vw;
    max-height: 80vh;
    object-fit: contain;
    background: #050505;
}

.media-modal-caption {
    max-width: 96vw;
    color: #fff;
    font-size: 0.92rem;
    text-align: center;
}

.rdo-video-grid .rdo-media-item {
    width: 180px;
}

.rdo-photo-cell {
    padding: 0 !important;
    text-align: center;
    vertical-align: middle !important;
}

.rdo-photo-cell .print-photo {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    margin: 0 auto;
}

.rdo-photo-caption {
    padding: 6px 8px;
    border-bottom: 1px solid #cfcfcf;
    text-align: left;
    font-weight: 700;
}

.rdo-signature-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    padding-top: 22px;
}

.rdo-signature-box {
    min-height: 180px;
    display: grid;
    align-content: end;
    justify-items: center;
    break-inside: avoid;
    overflow: hidden;
}

.rdo-signature-image-wrap {
    width: min(360px, 86%);
    height: 118px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.rdo-signature-box .print-signature {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center bottom;
    transform: none;
}

.rdo-signature-line {
    width: min(360px, 86%);
    border-top: 1px solid #c7c7c7;
}

.rdo-signature-label {
    margin-top: 7px;
    color: #555;
    font-size: 12px;
    text-align: center;
}

.rdo-signature-label span {
    display: block;
    margin-top: 3px;
    color: #111;
    font-weight: 700;
}

.rdo-table .status-badge {
    border-radius: 4px;
    min-height: 20px;
    padding: 3px 7px;
    font-size: 11px;
}

@media (max-width: 920px) {
    .auth-body {
        padding: 18px;
        align-items: start;
    }

    .auth-wrap {
        width: min(520px, 100%);
    }

    .auth-panel {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: 270px;
        padding: 26px;
    }

    .auth-hero h1 {
        font-size: 2.15rem;
    }

    .auth-copy {
        margin-top: 10px;
    }

    .auth-card {
        border-left: 0;
        border-top: 1px solid var(--color-border);
        padding: 26px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .pie-chart-wrap {
        min-height: 0;
    }

    .weather-panel {
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .weather-table {
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(86px, 0.8fr) repeat(3, minmax(74px, 1fr));
    }

    .weather-condition-table {
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(86px, 0.8fr) repeat(2, minmax(96px, 1fr));
    }

    .weather-period,
    .weather-period-label,
    .weather-choice {
        padding: 7px 6px;
        font-size: 0.8rem;
    }

    .report-edit-summary {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 9px 10px;
    }

    .report-edit-note {
        grid-column: 1 / -1;
        grid-row: 2;
        white-space: normal;
    }

    .report-edit-action {
        min-width: 42px;
        padding: 7px 10px;
    }

    .report-edit-body .grid-form {
        grid-template-columns: 1fr;
    }

    .report-edit-item {
        grid-template-columns: 1fr;
    }

    .report-edit-item-actions .btn {
        width: 100%;
    }

    .manual-layout {
        grid-template-columns: 1fr;
    }

    .manual-toc {
        position: static;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 20;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    .topbar {
        gap: 8px;
        padding: 10px 12px;
    }

    .topbar-right {
        gap: 8px;
        min-width: 0;
    }

    .topbar-user-name {
        max-width: 34vw;
        padding: 8px 9px;
        font-size: 0.86rem;
    }

    .topbar-logout .btn,
    .mobile-menu-btn {
        padding-inline: 10px;
    }

    .page {
        padding: var(--space-3);
    }

    h1 {
        font-size: 1.34rem;
    }

    .card {
        padding: 13px;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head .btn {
        width: 100%;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-row.search-row {
        grid-template-columns: 1fr;
    }

    .filter-row.search-row .btn {
        width: 100%;
    }

    .works-list-card,
    .reports-list-card {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .works-table-wrap,
    .reports-table-wrap {
        overflow-x: visible;
    }

    .works-table,
    .responsive-table,
    .works-table tbody,
    .responsive-table tbody,
    .works-table tr,
    .responsive-table tr,
    .works-table td,
    .responsive-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .works-table,
    .responsive-table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .works-table thead,
    .responsive-table thead {
        display: none;
    }

    .works-table tr,
    .responsive-table tr {
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: 8px;
        box-shadow: var(--shadow-soft);
        margin-bottom: 12px;
        overflow: hidden;
    }

    .works-table td,
    .responsive-table td {
        border-bottom: 1px solid var(--color-border);
        display: grid;
        gap: 8px;
        grid-template-columns: minmax(78px, 0.34fr) minmax(0, 1fr);
        padding: 10px 12px;
    }

    .works-table td::before,
    .responsive-table td::before {
        color: var(--color-muted);
        content: attr(data-label);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .works-table td:last-child,
    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .works-table .actions-inline,
    .responsive-table .actions-inline {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .works-table .actions-inline::before,
    .responsive-table .actions-inline::before {
        display: none;
    }

    .works-table .actions-inline .btn,
    .works-table .actions-inline form,
    .responsive-table .actions-inline .btn,
    .responsive-table .actions-inline form {
        width: 100%;
    }

    .works-table .works-empty-row td,
    .responsive-table .responsive-empty-row td {
        display: block;
    }

    .works-table .works-empty-row td::before,
    .responsive-table .responsive-empty-row td::before {
        content: none;
    }
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    html,
    body,
    .rdo-print-body {
        width: auto;
        min-height: 0;
        padding: 0;
        margin: 0;
        background: #fff !important;
    }

    .sidebar, .topbar, .btn, form, .mobile-menu-btn {
        display: none !important;
    }

    .media-modal {
        display: none !important;
    }

    .content, .page {
        padding: 0;
        margin: 0;
    }

    .card {
        border: 1px solid #999;
        break-inside: avoid;
    }

    .rdo-no-print {
        display: none !important;
    }

    .rdo-preview {
        overflow: visible;
        padding: 0;
    }

    .rdo-document {
        width: 100%;
        min-width: 0;
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        font-size: 10px;
    }

    .rdo-table th,
    .rdo-table td {
        border-color: #9f9f9f;
        padding: 4px 5px;
        font-size: 10px;
        line-height: 1.25;
    }

    .rdo-title-cell {
        font-size: 12px !important;
    }

    .rdo-brand-cell {
        height: 80px;
    }

    .rdo-logo {
        max-height: 66px;
    }

    .rdo-section {
        margin-top: 8px;
    }

    .rdo-qty-cell strong {
        font-size: 12px;
    }

    .rdo-file-cell .print-photo,
    .print-photo {
        max-width: 160px;
        max-height: 105px;
    }

    .rdo-photo-cell .print-photo {
        width: 100%;
        max-width: 100%;
        max-height: 320px;
    }

    .print-signature {
        max-width: 180px;
        max-height: 72px;
    }

    .rdo-signature-section {
        gap: 16px;
        padding-top: 14px;
    }

    .rdo-signature-box {
        min-height: 148px;
    }

    .rdo-signature-image-wrap {
        height: 96px;
    }

    .rdo-signature-box .print-signature {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        transform: none;
    }

    .rdo-signature-label {
        font-size: 10px;
    }
}
