:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --line: #dde4ee;
    --text: #172033;
    --muted: #667085;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --brand-soft: #d9f4ef;
    --green: #15803d;
    --green-soft: #dcfce7;
    --yellow: #b7791f;
    --yellow-soft: #fef3c7;
    --red: #c2410c;
    --red-soft: #ffedd5;
    --red-dark: #991b1b;
    --red-dark-soft: #fee2e2;
    --neutral-soft: #edf2f7;
    --shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    font-family: "Tahoma", "Arial", sans-serif;
}

* {
    box-sizing: border-box;
}

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

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

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

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #ecfeff 0%, #f8fafc 50%, #fff7ed 100%);
}

.auth-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

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

.sidebar {
    background: var(--surface);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    height: 72px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    font-weight: 800;
    color: var(--brand-strong);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.nav {
    padding: 16px 12px;
    display: grid;
    gap: 4px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #344054;
    border: 1px solid transparent;
}

.nav a.active,
.nav a:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border-color: #b7e5dd;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

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

.topbar {
    height: 72px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.content {
    width: min(1360px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.search-form {
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-head,
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.25;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.card {
    padding: 18px;
}

.panel-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-body {
    padding: 18px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 104px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.stat strong {
    display: block;
    font-size: 30px;
    line-height: 1;
    margin-top: 8px;
}

.tone-success {
    color: var(--green);
    background: var(--green-soft);
}

.tone-warning {
    color: var(--yellow);
    background: var(--yellow-soft);
}

.tone-danger {
    color: var(--red);
    background: var(--red-soft);
}

.tone-danger-dark {
    color: var(--red-dark);
    background: var(--red-dark-soft);
}

.tone-neutral {
    color: #475467;
    background: var(--neutral-soft);
}

.btn,
.icon-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.btn-secondary {
    border-color: var(--line);
    color: #344054;
}

.btn-danger {
    background: var(--red-dark);
    color: #fff;
}

.icon-btn {
    width: 40px;
    padding: 0;
    border-color: var(--line);
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: #344054;
    font-weight: 700;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #fff;
    padding: 9px 12px;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #99f6e4;
    border-color: var(--brand);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input {
    width: auto;
    min-height: auto;
}

.hidden {
    display: none !important;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

th,
td {
    text-align: right;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: var(--surface-muted);
    font-size: 13px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
}

.tab-btn {
    border: 0;
    background: transparent;
    padding: 12px 14px;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--brand-strong);
    border-bottom-color: var(--brand);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

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

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

.meta-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.meta-item-stack {
    align-items: flex-start;
}

.attachment-list {
    display: grid;
    gap: 8px;
    width: min(520px, 100%);
}

.attachment-list.compact {
    width: min(460px, 100%);
}

.attachment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.inline-details {
    position: relative;
}

.inline-details summary {
    list-style: none;
}

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

.branch-edit-form {
    margin-top: 10px;
    min-width: min(620px, 80vw);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.pagination {
    margin-top: 18px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

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

    .topbar,
    .page-head,
    .row-between {
        align-items: stretch;
        flex-direction: column;
    }

    .content {
        padding: 18px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .form-grid {
        grid-template-columns: 1fr;
    }
}
