:root {
    color-scheme: light;
    --ink: #111827;
    --muted: #64748b;
    --line: #d8e0ea;
    --panel: #ffffff;
    --soft: #f3f6f8;
    --accent: #1e3a5f;
    --accent-strong: #14263f;
    --warn: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(30, 58, 95, 0.12), rgba(100, 116, 139, 0.08)),
        var(--soft);
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
}

.brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 6vw, 80px);
    background:
        linear-gradient(rgba(11, 31, 42, 0.76), rgba(11, 31, 42, 0.76)),
        url("/images/login-hero.png");
    background-size: cover;
    background-position: center;
    color: white;
}

.brand-panel h1 {
    max-width: 680px;
    margin: 12px 0 18px;
    font-size: clamp(2.4rem, 5vw, 5rem);
    line-height: 1;
    letter-spacing: 0;
}

.summary {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.08rem;
    line-height: 1.6;
}

.eyebrow {
    margin: 0;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 48px 0 0;
    max-width: 960px;
}

.status-grid div {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
    padding: 16px;
    border-radius: 8px;
}

.status-grid dt {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
}

.status-grid dd {
    margin: 6px 0 0;
    font-weight: 700;
}

.login-panel {
    display: grid;
    align-items: center;
    padding: 28px;
}

.login-form {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 20px 70px rgba(24, 32, 42, 0.12);
}

.login-form h2 {
    margin: 8px 0 26px;
    font-size: 1.9rem;
    letter-spacing: 0;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.required-mark {
    color: var(--warn);
}

input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 13px;
    color: var(--ink);
    font: inherit;
}

input:focus {
    outline: 3px solid rgba(30, 58, 95, 0.18);
    border-color: var(--accent);
}

input[readonly],
textarea[readonly],
select:disabled {
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
    color: var(--muted);
    cursor: default;
}

input[readonly]:focus,
textarea[readonly]:focus,
select:disabled:focus {
    outline: 2px solid rgba(100, 116, 139, 0.16);
    border-color: #94a3b8;
}

button {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: var(--accent-strong);
}

.secondary-button {
    min-height: 40px;
    margin-top: 12px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
}

.secondary-button:hover {
    background: var(--soft);
}

button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.message {
    min-height: 22px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.message.error {
    color: var(--warn);
}

.message.success {
    padding: 10px 12px;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    background: #f0fdf4;
    color: #166534;
    font-weight: 700;
}

@media (max-width: 820px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: 42vh;
    }

    .brand-panel h1 {
        font-size: 2.6rem;
    }

    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.app-body {
    background: var(--soft);
}

[hidden] {
    display: none !important;
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-shell.no-sidebar-shell {
    grid-template-columns: minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 16px;
    border-right: 1px solid var(--line);
    background: white;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 100%;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--soft);
    color: var(--accent);
}

.sidebar-link-bottom {
    margin-top: auto;
}

.app-content {
    min-width: 0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px clamp(18px, 4vw, 48px);
    border-bottom: 1px solid var(--line);
    background: white;
}

.app-header h1 {
    margin: 6px 0 0;
    font-size: 2rem;
    letter-spacing: 0;
}

.header-context {
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.header-context:hover {
    color: var(--accent);
}

.app-header-actions-only {
    justify-content: flex-end;
}

.app-actions {
    display: grid;
    grid-template-columns: auto;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: end;
    justify-content: end;
    position: relative;
    row-gap: 6px;
    align-self: stretch;
    min-width: 190px;
}

.account-menu {
    position: relative;
    display: grid;
    justify-items: end;
}

.app-actions .helper-text {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.8);
    color: var(--accent-strong);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-actions .helper-text::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    margin-top: -3px;
    opacity: 0.78;
    transform: rotate(45deg);
    transform-origin: center;
    transition: margin 140ms ease, transform 140ms ease;
}

.app-actions .helper-text:hover,
.app-actions .helper-text:focus-visible,
.account-menu.is-open .helper-text {
    border-color: #bfdbfe;
    background: #eff6ff;
    outline: none;
}

.account-menu.is-open .helper-text::after {
    margin-top: 3px;
    transform: rotate(225deg);
}

.app-actions .secondary-button {
    width: auto;
    min-width: 110px;
    margin-top: 0;
    padding: 0 16px;
    white-space: nowrap;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.account-menu:focus-within .user-dropdown-menu,
.account-menu.is-open .user-dropdown-menu {
    display: block;
}

.user-dropdown-header {
    display: grid;
    gap: 2px;
    padding: 8px 9px 9px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}

.user-dropdown-header span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.user-dropdown-header strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.user-dropdown-item {
    width: 100%;
    min-height: 30px;
    padding: 0 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--warn);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.user-dropdown-item:hover,
.user-dropdown-item:focus-visible {
    background: #fef2f2;
    color: var(--warn);
    outline: none;
}

.header-powered {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.app-main {
    display: grid;
    gap: 20px;
    width: min(1120px, calc(100% - 36px));
    margin: 24px auto;
    min-width: 0;
}

.wide-main {
    width: min(1480px, calc(100% - 36px));
}

.module-main {
    width: calc(100% - 36px);
}

.full-main {
    width: calc(100% - 36px);
}

.workspace-panel {
    align-self: start;
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.workspace-panel.is-compact-edit {
    align-self: start;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 6px 0 0;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.helper-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.panel-heading .edit-helper-text {
    display: block;
    margin-top: 18px;
    line-height: 1.45;
}

.panel-heading .edit-helper-text:empty {
    display: none;
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.storage-summary {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

.storage-summary-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--accent-strong);
}

.storage-summary-copy span {
    color: var(--muted);
    font-weight: 700;
}

.storage-summary-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.storage-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: white;
}

.storage-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
    transition: width 160ms ease;
}

.storage-summary.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
}

.storage-summary.is-warning .storage-progress span {
    background: #d97706;
}

.storage-summary.is-danger {
    border-color: #fecaca;
    background: #fef2f2;
}

.storage-summary.is-danger .storage-progress span {
    background: var(--warn);
}

.context-button {
    width: auto;
    min-width: 150px;
    margin-top: 0;
    padding: 0 16px;
}

.context-button.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 280px) 140px;
    align-items: end;
    gap: 14px;
}

.inline-form label {
    margin-bottom: 0;
}

.user-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 14px;
}

.user-form label {
    margin-bottom: 0;
}

.company-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 14px;
}

.company-form label {
    margin-bottom: 0;
}

.stacked-form {
    display: grid;
    gap: 18px;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.form-actions button {
    width: auto;
    min-width: 180px;
    padding: 0 18px;
}

select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 13px;
    color: var(--ink);
    background: white;
    font: inherit;
}

textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 13px;
    color: var(--ink);
    background: white;
    font: inherit;
    resize: vertical;
}

select:focus {
    outline: 3px solid rgba(30, 58, 95, 0.18);
    border-color: var(--accent);
}

textarea:focus {
    outline: 3px solid rgba(30, 58, 95, 0.18);
    border-color: var(--accent);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
}

.checkbox-label input {
    width: 18px;
    min-height: 18px;
}

.wide-field {
    grid-column: span 2;
}

.compact-button {
    width: auto;
    min-width: 92px;
    margin-top: 0;
    padding: 0 12px;
}

.danger-button {
    border-color: #fecaca;
    color: var(--warn);
}

.danger-button:hover {
    background: #fef2f2;
}

.row-actions {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}

.row-menu {
    position: relative;
    z-index: 2;
}

.icon-menu-button {
    display: grid;
    place-items: center;
    width: 34px;
    min-width: 34px;
    min-height: 36px;
    margin-top: 0;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.row-menu-panel {
    position: absolute;
    display: grid;
    gap: 4px;
    z-index: 9999;
    top: calc(100% + 4px);
    left: 0;
    min-width: 120px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: 0 14px 34px rgba(24, 32, 42, 0.12);
}

.row-menu-panel.is-floating-menu {
    position: fixed;
    z-index: 30000;
}

.read-table tr.menu-open-row {
    position: relative;
    z-index: 500;
}

.read-table tr.menu-open-row td {
    position: relative;
    z-index: 501;
}

.read-table tr.menu-open-row td.row-actions {
    z-index: 10000;
}

.read-table tr.menu-open-row td.table-options-cell,
.read-table tr.menu-open-row td.project-options-cell {
    overflow: visible;
    z-index: 10000;
}

.row-menu-panel button {
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    background: white;
    color: var(--ink);
    text-align: left;
}

.row-menu-panel button:hover {
    background: var(--soft);
}

.row-menu-separator {
    height: 1px;
    margin: 6px 4px;
    background: var(--line);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.details-grid div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.details-grid .empty-details {
    padding: 0;
    border: 0;
    background: transparent;
}

.details-grid dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.details-grid dd {
    margin: 6px 0 0;
    overflow-wrap: anywhere;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.read-table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
}

.read-table {
    min-width: 2200px;
}

.companies-read-table,
.users-read-table {
    width: 100%;
    table-layout: fixed;
}

.companies-read-table {
    min-width: 2200px;
}

.users-read-table {
    min-width: 960px;
}

.companies-read-table th:nth-child(1),
.companies-read-table td:nth-child(1),
.users-read-table th:nth-child(1),
.users-read-table td:nth-child(1) {
    width: 64px;
}

.companies-read-table th:nth-child(2),
.companies-read-table td:nth-child(2),
.users-read-table th:nth-child(2),
.users-read-table td:nth-child(2) {
    width: 112px;
}

.companies-read-table th:nth-child(3),
.companies-read-table td:nth-child(3),
.users-read-table th:nth-child(3),
.users-read-table td:nth-child(3) {
    width: 72px;
}

.companies-read-table th:nth-child(4),
.companies-read-table td:nth-child(4) {
    width: 180px;
}

.companies-read-table th:nth-child(5),
.companies-read-table td:nth-child(5) {
    width: 110px;
}

.companies-read-table th:nth-child(6),
.companies-read-table td:nth-child(6) {
    width: 100px;
}

.companies-read-table th:nth-child(7),
.companies-read-table td:nth-child(7),
.companies-read-table th:nth-child(8),
.companies-read-table td:nth-child(8) {
    width: 170px;
}

.companies-read-table th:nth-child(9),
.companies-read-table td:nth-child(9) {
    width: 130px;
}

.companies-read-table th:nth-child(10),
.companies-read-table td:nth-child(10) {
    width: 120px;
}

.companies-read-table th:nth-child(11),
.companies-read-table td:nth-child(11),
.companies-read-table th:nth-child(12),
.companies-read-table td:nth-child(12) {
    width: 220px;
}

.companies-read-table th:nth-child(13),
.companies-read-table td:nth-child(13),
.companies-read-table th:nth-child(14),
.companies-read-table td:nth-child(14) {
    width: 120px;
}

.companies-read-table th:nth-child(15),
.companies-read-table td:nth-child(15) {
    width: 190px;
}

.companies-read-table th:nth-child(16),
.companies-read-table td:nth-child(16) {
    width: 150px;
}

.companies-read-table th:nth-child(17),
.companies-read-table td:nth-child(17) {
    width: 170px;
}

.companies-read-table th:nth-child(18),
.companies-read-table td:nth-child(18),
.companies-read-table th:nth-child(19),
.companies-read-table td:nth-child(19) {
    width: 220px;
}

.users-read-table th:nth-child(4),
.users-read-table td:nth-child(4) {
    width: 20%;
}

.users-read-table th:nth-child(5),
.users-read-table td:nth-child(5) {
    width: 160px;
}

.users-read-table th:nth-child(6),
.users-read-table td:nth-child(6) {
    width: 120px;
}

.users-read-table th:nth-child(7),
.users-read-table td:nth-child(7) {
    width: 22%;
}

.users-read-table th:nth-child(8),
.users-read-table td:nth-child(8) {
    width: auto;
}

.company-users-read-table {
    min-width: 900px;
}

.company-users-read-table th:nth-child(1),
.company-users-read-table td:nth-child(1) {
    width: 112px;
}

.company-users-read-table th:nth-child(2),
.company-users-read-table td:nth-child(2) {
    width: 72px;
}

.company-users-read-table th:nth-child(3),
.company-users-read-table td:nth-child(3) {
    width: 22%;
}

.company-users-read-table th:nth-child(4),
.company-users-read-table td:nth-child(4) {
    width: 22%;
}

.company-users-read-table th:nth-child(5),
.company-users-read-table td:nth-child(5) {
    width: 120px;
}

.company-users-read-table th:nth-child(6),
.company-users-read-table td:nth-child(6) {
    width: 22%;
}

.system-users-read-table th:nth-child(1),
.system-users-read-table td:nth-child(1) {
    width: 112px;
}

.system-users-read-table th:nth-child(2),
.system-users-read-table td:nth-child(2) {
    width: 72px;
}

.system-users-read-table th:nth-child(n + 3),
.system-users-read-table td:nth-child(n + 3) {
    width: 20%;
}

.system-companies-read-table {
    min-width: 3496px;
}

.system-companies-read-table th:nth-child(1),
.system-companies-read-table td:nth-child(1) {
    width: 112px;
}

.system-companies-read-table th:nth-child(2),
.system-companies-read-table td:nth-child(2) {
    width: 72px;
}

.system-companies-read-table th:nth-child(n + 3),
.system-companies-read-table td:nth-child(n + 3) {
    width: 185px;
}

.projects-read-table {
    width: 100%;
    min-width: 1920px;
    table-layout: fixed;
}

.projects-read-table th:nth-child(1),
.projects-read-table td:nth-child(1) {
    width: 64px;
}

.projects-read-table th:nth-child(2),
.projects-read-table td:nth-child(2) {
    width: 112px;
}

.templates-read-table {
    width: 100%;
    min-width: 760px;
    table-layout: fixed;
}

.contacts-read-table {
    width: 100%;
    min-width: 980px;
    table-layout: fixed;
}

.contacts-read-table th,
.contacts-read-table td {
    width: calc(100% / 7);
}

.section-rows-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.section-panel .read-table-wrap {
    margin: 0 16px;
    border-radius: 6px;
    overflow: visible;
}

.section-rows-table th {
    background: var(--accent-strong);
    color: white;
    font-size: 0.74rem;
}

.section-rows-table td {
    background: white;
}

.section-rows-table th:nth-child(1),
.section-rows-table td:nth-child(1) {
    width: 5%;
}

.section-rows-table th:nth-child(2),
.section-rows-table td:nth-child(2) {
    width: 26%;
}

.section-rows-table th:nth-child(3),
.section-rows-table td:nth-child(3) {
    width: 26%;
}

.section-rows-table th:nth-child(4),
.section-rows-table td:nth-child(4) {
    width: 33%;
}

.section-rows-table th:nth-child(5),
.section-rows-table td:nth-child(5) {
    width: 10%;
}

.read-table th,
.read-table td {
    white-space: nowrap;
}

.read-table td {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.read-table td.row-actions {
    overflow: visible;
}

.read-table .row-actions {
    min-width: 134px;
    z-index: 30;
}

.read-table.section-rows-table .row-actions {
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: none;
    padding-inline: 10px;
}

.read-table.section-rows-table .icon-menu-button {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    font-size: 1rem;
}

.read-table .compact-button {
    min-width: 82px;
    min-height: 36px;
    padding: 0 10px;
}

.read-table td.table-options-cell,
.projects-read-table td.project-options-cell {
    overflow: visible;
}

.read-table .table-options-actions,
.projects-read-table .project-options-actions {
    justify-content: center;
    min-width: 0;
}

.read-table td.table-options-cell,
.read-table td.table-enabled-cell,
.projects-read-table td.project-options-cell,
.projects-read-table td.project-enabled-cell {
    text-align: center;
    vertical-align: middle;
}

.company-users-read-table td.table-enabled-cell,
.system-users-read-table td.table-enabled-cell,
.system-companies-read-table td.table-enabled-cell,
.projects-read-table td.project-enabled-cell {
    overflow: visible;
}

.user-status-tip,
.company-status-tip,
.project-status-tip,
.company-user-status-tip {
    position: relative;
    display: inline-flex;
    justify-content: center;
}

.user-status-tip::after,
.company-status-tip::after,
.project-status-tip::after,
.company-user-status-tip::after {
    display: none;
    content: none;
}

.floating-tooltip {
    position: fixed;
    z-index: 30000;
    width: max-content;
    max-width: 280px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    box-shadow: 0 14px 34px rgba(24, 32, 42, 0.16);
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
    text-align: left;
    text-transform: none;
    white-space: normal;
}

.status-button.is-enabled {
    border-color: #86efac;
    background: #ecfdf5;
    color: #166534;
}

.status-button.is-enabled:hover {
    background: #dcfce7;
}

.status-button.is-disabled {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #475569;
}

.status-button.is-disabled:hover {
    background: #e2e8f0;
}

.status-row-enabled {
    background: #ecfdf5;
}

.status-row-disabled {
    background: #f1f5f9;
}

.status-row-enabled:hover {
    background: #dcfce7;
}

.status-row-disabled:hover {
    background: #e2e8f0;
}

.project-status-planning {
    background: #fefce8;
}

.project-status-planning:hover {
    background: #fef9c3;
}

.project-status-active {
    background: #eff6ff;
}

.project-status-active:hover {
    background: #dbeafe;
}

.project-status-on-hold {
    background: #fff7ed;
}

.project-status-on-hold:hover {
    background: #ffedd5;
}

.project-status-completed {
    background: #ecfdf5;
}

.project-status-completed:hover {
    background: #dcfce7;
}

.project-status-cancelled {
    background: #fef2f2;
}

.project-status-cancelled:hover {
    background: #fee2e2;
}

.project-status-disabled {
    background: #f1f5f9;
}

.project-status-disabled:hover {
    background: #e2e8f0;
}

.clickable-row {
    cursor: pointer;
}

.read-table tr.clickable-row:hover td {
    background: #eef6ff;
}

.read-table tr.clickable-row:focus-within td {
    background: #eef6ff;
}

.read-table tr.clickable-row:hover td:first-child,
.read-table tr.clickable-row:focus-within td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}

.module-section {
    min-width: 0;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    align-items: start;
    gap: 20px;
}

.module-card {
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
}

.module-card:hover {
    border-color: var(--accent);
    box-shadow: 0 14px 34px rgba(24, 32, 42, 0.08);
}

.module-card span {
    font-size: 1.22rem;
    font-weight: 700;
}

.module-card small {
    color: var(--muted);
    line-height: 1.5;
}

.project-builder {
    display: grid;
    gap: 18px;
}

.project-read-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}

.project-details-main {
    display: grid;
    min-width: 0;
    gap: 18px;
}

.project-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.project-overview-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
}

.project-overview-copy {
    min-width: 0;
}

.project-overview h3 {
    margin: 4px 0 6px;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 1.28rem;
}

.project-overview-facts {
    display: grid;
    gap: 5px;
}

.project-overview-facts p,
.project-overview-audit p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.project-overview-facts strong,
.project-overview-audit strong {
    color: var(--ink);
}

.project-overview-audit {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.project-overview-audit p {
    font-size: 0.78rem;
    font-weight: 700;
}

.project-overview-total {
    min-width: 170px;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    text-align: right;
}

.project-overview-total span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.project-overview-total strong {
    display: block;
    margin-top: 6px;
    color: var(--accent-strong);
    font-size: 1.38rem;
}

.project-overview-total small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.3;
}

.project-overview-details {
    display: grid;
    gap: 8px;
}

.project-overview-details strong {
    color: var(--ink);
}

.project-builder-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.project-builder-actions .message {
    margin: 0;
}

.project-builder-actions .inline-form {
    grid-template-columns: minmax(240px, 360px) 140px;
    width: auto;
    margin-left: auto;
}

.template-create-panel {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.template-create-panel {
    margin-bottom: 14px;
}

.template-picker-list {
    display: grid;
    gap: 10px;
}

.template-picker-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.template-picker-row:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.template-picker-row input {
    margin-top: 3px;
}

.template-picker-row span {
    display: grid;
    gap: 4px;
}

.template-picker-row small,
.template-picker-row em {
    color: var(--muted);
    font-style: normal;
}

.section-list {
    display: grid;
    gap: 18px;
}

.section-panel {
    display: grid;
    gap: 12px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    overflow: visible;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.section-panel-heading {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-left: 4px solid var(--accent);
    border-bottom: 1px solid var(--line);
    background: #e8eef6;
}

.section-panel-heading.menu-open-row {
    z-index: 10000;
}

.section-heading-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.section-heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-heading-actions .section-menu-panel {
    right: 0;
    left: auto;
}

.section-panel-heading h3 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 1rem;
}

.section-heading-message {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.section-heading-message:empty {
    display: none;
}

.section-panel-heading strong {
    padding: 6px 10px;
    border-radius: 6px;
    background: white;
    color: var(--ink);
    font-size: 1rem;
}

.section-row-form {
    grid-template-columns: minmax(140px, 1.2fr) minmax(140px, 1fr) minmax(160px, 1.2fr) minmax(110px, 0.6fr) auto auto;
    padding: 0 16px 16px;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
}

.app-modal-panel {
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.app-modal-panel .panel-heading {
    margin-bottom: 16px;
    padding: 0;
}

.document-list {
    display: grid;
    gap: 10px;
}

.document-summary {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.document-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.document-row-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.document-row-copy strong {
    overflow-wrap: anywhere;
}

.document-row-copy small {
    color: var(--muted);
    font-weight: 700;
}

.document-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.notice-modal-box {
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.notice-modal-box.success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.notice-modal-box.error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: var(--warn);
}

.gallery-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.gallery-directory-wrap {
    overflow-x: visible;
}

.gallery-projects-table {
    min-width: 0;
}

.gallery-photo-guidance {
    margin-top: 8px;
}

.gallery-column {
    display: grid;
    gap: 12px;
}

.gallery-column-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gallery-column-heading h3 {
    margin: 0;
    font-size: 1rem;
}

.gallery-column-heading span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.gallery-tile {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.gallery-photo-placeholder {
    display: grid;
    min-height: 130px;
    place-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background:
            linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(14, 165, 233, 0.12)),
            #f8fafc;
    color: #0f766e;
    font-weight: 800;
    text-align: center;
}

.gallery-photo-placeholder img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    border-radius: 6px;
    background: #020617;
}

.gallery-tile.after .gallery-photo-placeholder {
    background:
            linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(250, 204, 21, 0.14)),
            #f8fafc;
    color: #166534;
}

.gallery-tile-footer {
    display: grid;
    gap: 2px;
    padding: 10px;
}

.gallery-tile-footer strong {
    font-size: 0.9rem;
}

.gallery-tile-footer small {
    color: var(--muted);
}

.gallery-tile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.gallery-presentation-board {
    display: grid;
    height: calc(100vh - 170px);
    min-height: 520px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
    padding: 18px;
    border-radius: 8px;
    background: #020617;
    color: #f8fafc;
    overflow: hidden;
}

.gallery-presentation-panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.gallery-presentation-panel .panel-heading {
    padding: 0 0 12px;
}

.gallery-presentation-panel:fullscreen {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    padding: 18px;
    background: #020617;
}

.gallery-presentation-panel:fullscreen .panel-heading {
    color: #f8fafc;
}

.gallery-presentation-panel:fullscreen .gallery-presentation-board {
    height: 100%;
    min-height: 0;
    padding: 0;
}

.gallery-presentation-panel:fullscreen .panel-heading {
    margin-bottom: 12px;
}

.gallery-presentation-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    gap: 12px;
}

.gallery-presentation-toolbar .secondary-button {
    width: auto;
    margin-top: 0;
    padding: 0 16px;
}

.gallery-presentation-toolbar strong {
    min-width: 72px;
    text-align: center;
}

.gallery-presentation-stage {
    display: grid;
    height: 100%;
    min-height: 0;
    place-items: center;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: #020617;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    overflow: hidden;
}

.gallery-presentation-stage img {
    display: none;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-presentation-caption {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 54px;
    min-width: 0;
    overflow: hidden;
    text-align: center;
}

.gallery-presentation-caption strong,
.gallery-presentation-caption small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-presentation-caption small {
    color: #cbd5e1;
}

@media (max-width: 820px) {
    .gallery-board {
        grid-template-columns: 1fr;
    }

    .gallery-presentation-board {
        min-height: 480px;
    }

    .gallery-presentation-toolbar {
        flex-wrap: wrap;
    }
}


table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

@media (max-width: 760px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-height: auto;
    }

    .sidebar-link {
        justify-content: center;
        text-align: center;
    }

    .sidebar-link-bottom {
        margin-top: 0;
    }

    .app-header,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .app-actions,
    .inline-form,
    .user-form,
    .company-form,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .app-actions {
        justify-items: stretch;
        min-width: 0;
    }

    .app-actions .helper-text {
        justify-content: center;
    }

    .account-menu {
        justify-items: stretch;
    }

    .user-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
    }

    .header-powered {
        justify-self: stretch;
        text-align: center;
    }

    .wide-field {
        grid-column: span 1;
    }

    .compact-button {
        width: 100%;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .project-read-layout {
        grid-template-columns: 1fr;
    }

    .project-overview {
        grid-template-columns: 1fr;
    }

    .project-builder-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .project-builder-actions .inline-form {
        width: 100%;
    }
}
