:root {
    --page: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #071a38;
    --muted: #66758d;
    --line: #dbe4ef;
    --sidebar: #151f2b;
    --sidebar-soft: #303a46;
    --accent: #6aa9a4;
    --accent-dark: #477c78;
    --accent-soft: #eef8f6;
    --blue: #7f9fd6;
    --blue-dark: #5273ad;
    --blue-soft: #eef4ff;
    --purple: #a188d2;
    --purple-dark: #745da9;
    --purple-soft: #f5f1fc;
    --warm: #d8a27e;
    --warm-soft: #fff4ed;
    --file: #86a1b3;
    --file-soft: #eef5f7;
    --warning: #b98545;
    --danger: #c76f68;
    --shadow: 0 18px 45px rgba(24, 33, 29, 0.08);
    --shadow-soft: 0 8px 24px rgba(24, 33, 29, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

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

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(127, 159, 214, 0.7);
    box-shadow: 0 0 0 3px rgba(127, 159, 214, 0.16);
}

button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 16px;
    color: #edf4ff;
    background: var(--sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-color: rgba(237, 244, 255, 0.28) transparent;
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    border: 2px solid var(--sidebar);
    border-radius: 999px;
    background: rgba(237, 244, 255, 0.28);
}

.brand,
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    padding-bottom: 2px;
}

.brand p,
.login-brand p {
    margin: 0;
    color: rgba(237, 244, 255, 0.72);
    font-size: 12px;
    text-transform: uppercase;
}

.brand strong,
.login-brand h1 {
    display: block;
    margin: 0;
    font-size: 22px;
    line-height: 1.05;
}

.brand-version {
    color: rgba(237, 244, 255, 0.68);
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.login-brand .brand-version {
    color: var(--muted);
}

.mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
    background: #d97878;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.sidebar-block {
    display: grid;
    gap: 12px;
}

.sidebar-title {
    color: rgba(237, 244, 255, 0.58);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.company-list,
.category-list,
.sidebar-category-list {
    display: grid;
    gap: 6px;
}

.company-node {
    display: grid;
    gap: 5px;
}

.company-node.active {
    gap: 6px;
}

.company-link,
.section-link,
.global-finance-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    border-radius: 8px;
    padding: 9px 10px;
    color: rgba(237, 244, 255, 0.84);
    border: 1px solid transparent;
}

.company-link:hover,
.section-link:hover,
.global-finance-link:hover {
    background: var(--sidebar-soft);
    color: #fff;
}

.company-link.active,
.section-link.active,
.global-finance-link.active {
    border-color: rgba(255, 255, 255, 0.04);
    background: var(--sidebar-soft);
    color: #fff;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.1);
}

.company-link {
    justify-content: flex-start;
    font-weight: 500;
}

.company-link.active {
    font-weight: 600;
}

.company-avatar {
    display: grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 7px;
    background: rgba(237, 244, 255, 0.11);
    color: rgba(237, 244, 255, 0.9);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.company-link.active .company-avatar {
    background: rgba(127, 159, 214, 0.24);
    color: #fff;
}

.company-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-link.active::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid rgba(237, 244, 255, 0.72);
    border-bottom: 2px solid rgba(237, 244, 255, 0.72);
    margin-left: auto;
    transform: rotate(45deg);
}

.global-finance-link {
    justify-content: flex-start;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(237, 244, 255, 0.9);
    font-weight: 600;
}

.global-finance-link::before {
    content: "";
    display: block;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(106, 169, 164, 0.95), rgba(127, 159, 214, 0.9));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.company-sections {
    display: grid;
    position: relative;
    gap: 3px;
    margin: 2px 0 2px 22px;
    padding-left: 15px;
}

.company-sections::before,
.sidebar-submenu::before {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    width: 1px;
    background: rgba(237, 244, 255, 0.14);
}

.section-node {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.section-node.active {
    padding-bottom: 2px;
}

.company-sections .section-link {
    justify-content: flex-start;
    min-height: 34px;
    padding: 7px 9px;
    color: rgba(237, 244, 255, 0.76);
    font-size: 14px;
    font-weight: 500;
}

.company-sections .section-link::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: rgba(237, 244, 255, 0.26);
}

.company-sections .section-link[data-section="labels"]::before {
    background: var(--accent);
}

.company-sections .section-link[data-section="tasks"]::before {
    background: var(--blue);
}

.company-sections .section-link[data-section="finances"]::before {
    background: var(--purple);
}

.company-sections .section-link[data-section="accesses"]::before {
    background: var(--warm);
}

.company-sections .section-link[data-section="files"]::before {
    background: var(--file);
}

.company-sections .section-link.active {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font-weight: 600;
    box-shadow: none;
}

.company-sections .section-link.active::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 999px;
    margin-left: auto;
    background: rgba(237, 244, 255, 0.86);
}

.sidebar-submenu {
    display: grid;
    position: relative;
    gap: 8px;
    margin-left: 17px;
    padding-left: 18px;
}

.section-submenu {
    gap: 6px;
    margin: -1px 0 5px 15px;
    padding-left: 15px;
}

.section-submenu::before {
    background: rgba(237, 244, 255, 0.1);
}

.section-submenu .sidebar-subtitle {
    color: rgba(237, 244, 255, 0.5);
    font-size: 11px;
}

.section-submenu .sidebar-category-list {
    gap: 5px;
}

.section-submenu .sidebar-category-list a {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 13px;
}

.section-submenu .sidebar-create-category {
    grid-template-columns: minmax(0, 1fr) 31px;
}

.section-submenu .sidebar-create-category input,
.section-submenu .sidebar-create-category button {
    min-height: 32px;
}

.sidebar-subtitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: rgba(237, 244, 255, 0.58);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-subtitle em,
.sidebar-category-list em {
    display: grid;
    min-width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 999px;
    background: rgba(237, 244, 255, 0.1);
    color: rgba(237, 244, 255, 0.74);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
}

.sidebar-category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 36px;
    border-radius: 8px;
    padding: 8px 9px;
    color: rgba(237, 244, 255, 0.76);
    font-weight: 400;
}

.sidebar-category-list a::before {
    content: "";
    flex: 0 0 5px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgba(237, 244, 255, 0.26);
}

.sidebar-category-list a span {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-category-list a:hover,
.sidebar-category-list a.active {
    background: rgba(255, 255, 255, 0.065);
    color: #fff;
}

.sidebar-category-list a.active {
    box-shadow: inset 2px 0 0 var(--accent);
    color: #fff;
    font-weight: 500;
}

.sidebar-category-list a.active::before {
    background: var(--accent);
}

.sidebar-empty {
    color: rgba(237, 244, 255, 0.48);
    font-size: 13px;
    padding: 5px 2px;
}

.sidebar-empty.nested {
    border-left: 1px solid rgba(237, 244, 255, 0.14);
    margin-left: 17px;
    padding-left: 18px;
}

.sidebar-create-category {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 7px;
}

.sidebar-create-category input {
    min-width: 0;
    min-height: 36px;
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.045);
    color: #fff;
    padding: 8px 10px;
}

.sidebar-create-category input::placeholder {
    color: rgba(237, 244, 255, 0.48);
}

.sidebar-create-category button {
    min-height: 36px;
    background: rgba(127, 159, 214, 0.82);
    color: #fff;
    font-size: 19px;
    font-weight: 700;
}

.inline-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 7px;
    border-top: 1px solid rgba(237, 244, 255, 0.08);
    margin-top: 2px;
    padding-top: 12px;
}

.inline-create input {
    min-width: 0;
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    min-height: 40px;
}

.inline-create input::placeholder {
    color: rgba(237, 244, 255, 0.5);
}

.inline-create button {
    background: var(--blue);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(127, 159, 214, 0.18);
}

.inline-create button:hover {
    background: var(--blue-dark);
}

.sidebar-create-category button:hover {
    background: rgba(127, 159, 214, 0.95);
}

.logout-form {
    margin-top: auto;
}

.logout-form button {
    width: 100%;
    min-height: 40px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(237, 244, 255, 0.85);
}

.logout-form button:hover {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
}

.main {
    min-width: 0;
    max-width: 1660px;
    padding: 30px 34px 42px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--purple);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: 34px;
    line-height: 1.08;
    font-weight: 700;
}

h2 {
    margin-bottom: 5px;
    font-size: 23px;
}

h3 {
    margin-bottom: 0;
    font-size: 19px;
    font-weight: 700;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.breadcrumbs span:not(:last-child)::after {
    content: "/";
    margin-left: 8px;
    color: #a5afa8;
}

.quick-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.quick-stats span {
    display: grid;
    min-width: 128px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    border-top: 3px solid var(--accent);
    padding: 12px 14px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    box-shadow: var(--shadow-soft);
}

.quick-stats span:nth-child(2n) {
    border-top-color: var(--blue);
}

.quick-stats .status-waiting {
    border-top-color: var(--warm);
}

.quick-stats .status-progress {
    border-top-color: var(--blue);
}

.quick-stats .status-review {
    border-top-color: var(--purple);
}

.quick-stats .status-done {
    border-top-color: var(--accent);
}

.quick-stats .status-paused {
    border-top-color: var(--muted);
}

.quick-stats .finance-stat-income {
    border-top-color: var(--accent);
}

.quick-stats .finance-stat-expense {
    border-top-color: var(--danger);
}

.quick-stats .finance-stat-balance {
    border-top-color: var(--purple);
}

.quick-stats .access-stat {
    border-top-color: var(--warm);
}

.quick-stats .files-stat {
    border-top-color: var(--file);
}

.quick-stats strong {
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
}

.flash {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.flash.success {
    border-color: rgba(106, 169, 164, 0.36);
    color: var(--accent-dark);
}

.flash.error {
    border-color: rgba(199, 111, 104, 0.32);
    color: var(--danger);
}

.category-panel,
.label-panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.workspace {
    overflow: visible;
}

.language-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.language-tabs a {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    background: #fff;
    color: var(--muted);
    font-weight: 600;
}

.language-tabs a.active,
.language-tabs a:hover {
    border-color: rgba(106, 169, 164, 0.34);
    background: rgba(106, 169, 164, 0.12);
    color: var(--accent-dark);
}

.language-create input {
    width: 118px;
    border-color: var(--line);
    background: #fff;
    color: var(--text);
}

.language-create button {
    background: var(--accent);
    color: #fff;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 0;
}

.category-panel,
.label-panel {
    box-shadow: none;
}

.category-panel {
    align-self: start;
    padding: 14px;
}

.panel-title,
.label-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-title {
    margin-bottom: 12px;
}

.panel-title span {
    display: grid;
    min-width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    background: #f0f4ef;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--muted);
}

.category-list a:hover,
.category-list a.active {
    background: rgba(106, 169, 164, 0.12);
    color: var(--accent-dark);
}

.category-list em {
    min-width: 24px;
    border-radius: 999px;
    background: #edf3ee;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    text-align: center;
}

.stack-form,
.link-form,
.edit-form {
    display: grid;
    gap: 12px;
}

.stack-form {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.primary-button,
.secondary-button,
.danger-button,
.search-form button {
    min-height: 40px;
    padding: 0 14px;
    font-weight: 700;
}

.primary-button {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(127, 159, 214, 0.18);
}

.primary-button:hover {
    background: var(--blue-dark);
    box-shadow: 0 10px 22px rgba(127, 159, 214, 0.22);
}

.secondary-button {
    background: #edf3ee;
    color: var(--text);
}

.danger-button {
    border: 1px solid rgba(199, 111, 104, 0.18);
    background: rgba(199, 111, 104, 0.08);
    color: var(--danger);
}

.danger-button:hover {
    background: rgba(199, 111, 104, 0.13);
}

.label-panel {
    min-width: 0;
    border-top: 3px solid var(--purple);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.label-head {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 15px;
}

.label-head h3 {
    margin-bottom: 3px;
}

.panel-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.search-form {
    display: grid;
    width: min(390px, 100%);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.search-form button {
    background: var(--blue-soft);
    color: var(--text);
}

.search-form button:hover {
    background: #e2ebfb;
    color: var(--blue-dark);
}

.link-form {
    grid-template-columns: minmax(130px, 180px) minmax(180px, 1fr);
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.link-form .wide,
.link-form button {
    grid-column: 1 / -1;
}

.task-form {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(140px, 0.5fr) minmax(140px, 0.5fr) minmax(140px, 0.5fr) minmax(140px, 0.5fr) minmax(240px, 1.4fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.finance-form {
    display: grid;
    grid-template-columns: minmax(130px, 0.6fr) minmax(150px, 0.6fr) minmax(140px, 0.6fr) minmax(260px, 1.4fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.access-panel {
    border-top-color: var(--warm);
}

.access-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.access-table {
    min-width: 860px;
}

.access-table th:first-child,
.access-table td:first-child {
    width: 54px;
    text-align: center;
}

.access-table th:nth-child(2) {
    width: 17%;
}

.access-table th:nth-child(3) {
    width: 28%;
}

.access-table th:nth-child(4) {
    width: 20%;
}

.password-display {
    display: grid;
    min-width: 240px;
    gap: 7px;
}

.password-display input {
    min-height: 36px;
    padding: 7px 10px;
    background: var(--panel-soft);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.password-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.password-button {
    min-height: 30px;
    border: 1px solid rgba(127, 159, 214, 0.2);
    padding: 0 9px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 12px;
    font-weight: 600;
}

.password-button:hover {
    border-color: rgba(127, 159, 214, 0.4);
    background: #e2ebfb;
}

.password-error {
    color: var(--danger);
    font-size: 13px;
}

.site-link {
    display: block;
    max-width: 260px;
    overflow: hidden;
    color: var(--accent-dark);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-link:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

.comment-cell {
    max-width: 340px;
    color: var(--muted);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.comment-cell span {
    color: #a4afbf;
}

.access-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.access-edit-form .primary-button {
    grid-column: 1 / -1;
}

.files-panel {
    border-top-color: var(--file);
}

.file-upload-form {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) 176px minmax(260px, 1.3fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.file-upload-form [hidden] {
    display: none;
}

.file-source-field {
    display: grid;
    gap: 7px;
}

.file-source-field > .field-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.file-source-switch {
    display: grid;
    min-height: 42px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px;
    background: var(--panel-soft);
}

.file-source-switch label {
    position: relative;
    display: block;
}

.file-source-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-source-switch span {
    display: grid;
    min-height: 34px;
    place-items: center;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.file-source-switch input:checked + span {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 4px rgba(24, 33, 29, 0.1);
}

.file-source-switch input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(127, 159, 214, 0.2);
}

.file-upload-form input[type="file"] {
    min-height: 42px;
    padding: 5px 6px;
    color: var(--muted);
}

.file-upload-form input[type="file"]::file-selector-button {
    min-height: 30px;
    margin-right: 10px;
    border: 0;
    border-radius: 7px;
    padding: 0 10px;
    background: var(--file-soft);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.project-files-table {
    min-width: 820px;
}

.project-files-table th:first-child,
.project-files-table td:first-child {
    width: 54px;
    text-align: center;
}

.project-files-table th:nth-child(2) {
    width: 28%;
}

.project-files-table th:nth-child(3),
.project-files-table td:nth-child(3) {
    width: 170px;
    white-space: nowrap;
}

.file-name-link {
    display: grid;
    width: fit-content;
    max-width: 360px;
    gap: 3px;
    color: var(--blue-dark);
}

.file-name-link span {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name-link small {
    color: var(--muted);
    font-size: 12px;
}

.file-external-link small {
    color: var(--accent-dark);
}

.file-name-link:hover span {
    color: var(--accent-dark);
    text-decoration: underline;
}

.file-edit-form {
    width: min(460px, calc(100vw - 40px));
}

.month-finance-summary {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.month-finance-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.month-finance-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.month-finance-head strong {
    color: var(--text);
    font-weight: 600;
}

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

.month-finance-grid span {
    display: grid;
    gap: 3px;
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 12px;
}

.month-finance-grid strong {
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
}

.month-finance-expense {
    border-left-color: var(--danger) !important;
}

.month-finance-balance {
    border-left-color: var(--purple) !important;
}

.project-finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.project-finance-card {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    border-top: 3px solid var(--blue);
    padding: 14px;
    background: #fff;
    color: var(--muted);
    box-shadow: 0 6px 18px rgba(7, 26, 56, 0.05);
}

.project-finance-card:hover {
    border-color: rgba(127, 159, 214, 0.42);
    color: var(--blue-dark);
}

.project-finance-card span {
    color: var(--text);
    font-weight: 600;
}

.project-finance-card strong {
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
}

.project-finance-card small {
    font-size: 12px;
}

.project-finance-card em {
    width: fit-content;
    border-radius: 999px;
    padding: 3px 8px;
    background: #eef1f5;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
}

.finance-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}

.finance-income {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.finance-expense {
    background: rgba(199, 111, 104, 0.1);
    color: var(--danger);
}

.finance-table td:nth-child(4),
.finance-table th:nth-child(4) {
    text-align: right;
}

.all-finance-table td:nth-child(4),
.all-finance-table th:nth-child(4) {
    text-align: left;
}

.all-finance-table td:nth-child(5),
.all-finance-table th:nth-child(5) {
    text-align: right;
}

.project-link {
    color: var(--blue-dark);
    font-weight: 600;
}

.project-link:hover {
    color: var(--accent-dark);
}

.money-cell {
    white-space: nowrap;
    font-weight: 700;
}

.money-income {
    color: var(--accent-dark);
}

.money-expense {
    color: var(--danger);
}

.task-board {
    display: grid;
    gap: 18px;
    margin-top: 4px;
}

.task-group {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.task-group:first-child {
    border-top: 0;
    padding-top: 0;
}

.task-group-head {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.task-group-head h4 {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

.task-group-head h4::before {
    content: "";
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--muted);
}

.task-group-head span {
    display: inline-flex;
    min-width: 30px;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef1f5;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.task-group-progress .task-group-head h4::before {
    background: var(--blue);
}

.task-group-review .task-group-head h4::before {
    background: var(--purple);
}

.task-group-waiting .task-group-head h4::before {
    background: var(--warm);
}

.task-group-paused .task-group-head h4::before {
    background: var(--muted);
}

.task-group-done .task-group-head h4::before {
    background: var(--accent);
}

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

.task-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(7, 26, 56, 0.05);
}

.task-item.done {
    background: #f8faf7;
}

.task-item.done .task-body strong {
    color: var(--muted);
    text-decoration: line-through;
}

.task-body {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.deadline-line {
    color: var(--purple-dark);
    font-weight: 600;
}

.task-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.task-title-row strong {
    font-weight: 600;
}

.task-number {
    display: inline-flex;
    min-width: 38px;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef1f5;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}

.status-waiting {
    background: var(--warm-soft);
    color: #8f674d;
}

.status-progress {
    background: var(--blue-soft);
    color: var(--blue-dark);
}

.status-review {
    background: var(--purple-soft);
    color: var(--purple-dark);
}

.status-done {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.status-paused {
    background: #eef1f5;
    color: var(--muted);
}

.priority-badge {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}

.priority-low {
    background: #eef1f5;
    color: var(--muted);
}

.priority-medium {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.priority-high {
    background: var(--warm-soft);
    color: #8f674d;
}

.priority-urgent {
    background: rgba(199, 111, 104, 0.1);
    color: var(--danger);
}

.task-body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.task-body time {
    color: var(--muted);
    font-size: 12px;
}

.task-actions {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.task-actions summary {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    border-radius: 8px;
    background: var(--blue-soft);
    padding: 0 12px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.task-actions summary:hover {
    background: #e2ebfb;
    color: var(--blue-dark);
}

.task-actions summary::-webkit-details-marker {
    display: none;
}

.task-edit-form {
    position: absolute;
    right: 0;
    z-index: 5;
    display: grid;
    width: min(720px, calc(100vw - 40px));
    gap: 12px;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(24, 33, 29, 0.18);
}

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

.version-box {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel-soft);
}

.version-box legend {
    padding: 0 6px;
    color: var(--warm);
    font-size: 12px;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(7, 26, 56, 0.05);
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

td small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.4;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #f8fbff;
}

.article {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    padding: 3px 8px;
    font-weight: 600;
}

.external-link {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    border-radius: 8px;
    background: var(--purple-soft);
    padding: 3px 8px;
    color: var(--purple-dark);
    font-weight: 600;
}

.external-link:hover {
    background: #ece5f8;
}

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

.version-cell {
    display: grid;
    gap: 6px;
    min-width: 170px;
}

.version-cell small,
.version-cell time {
    display: block;
    color: var(--muted);
    line-height: 1.4;
}

.version-cell time {
    font-size: 12px;
}

.row-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.row-actions details {
    position: relative;
}

.row-actions summary {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    border-radius: 8px;
    background: var(--blue-soft);
    padding: 0 11px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.row-actions summary:hover {
    background: #e2ebfb;
    color: var(--blue-dark);
}

.row-actions summary::-webkit-details-marker {
    display: none;
}

.edit-form {
    position: absolute;
    right: 0;
    z-index: 5;
    width: min(860px, calc(100vw - 40px));
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(24, 33, 29, 0.18);
}

.empty-state,
.empty-row {
    color: var(--muted);
    text-align: center;
}

.empty-state {
    display: grid;
    min-height: 260px;
    place-content: center;
    gap: 8px;
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state.compact {
    min-height: 150px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: var(--page);
}

.login-card {
    width: min(420px, 100%);
    padding: 26px;
    box-shadow: var(--shadow);
}

.login-brand {
    margin-bottom: 22px;
}

.login-brand p {
    color: var(--muted);
}

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

@media (max-width: 1280px) and (min-width: 681px) {
    .file-upload-form {
        grid-template-columns: minmax(240px, 1fr) 190px;
    }

    .file-upload-form [data-file-source-panel] {
        grid-column: 1;
    }

    .file-upload-form > .primary-button {
        grid-column: 2;
        grid-row: 2;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: grid;
    }

    .quick-stats {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .main {
        padding: 18px;
    }

    .label-head {
        display: grid;
    }

    .quick-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-stats span {
        min-width: 0;
    }

    .language-tabs {
        justify-content: stretch;
    }

    .language-tabs a {
        flex: 1 1 auto;
        text-align: center;
    }

    .language-create {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .language-create input {
        width: 100%;
    }

    .link-form,
    .task-form,
    .finance-form,
    .access-form,
    .file-upload-form,
    .search-form {
        grid-template-columns: 1fr;
    }

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

    .month-finance-grid {
        grid-template-columns: 1fr;
    }

    .version-grid {
        grid-template-columns: 1fr;
    }

    .row-actions {
        flex-wrap: wrap;
    }

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

    .task-actions {
        flex-wrap: wrap;
    }

    .task-edit-form {
        position: static;
        width: 100%;
    }
}
