@font-face {
    font-family: 'PeydaWeb';
    src: url('/assets/fonts/PeydaWeb-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PeydaWeb';
    src: url('/assets/fonts/PeydaWeb-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PeydaWeb';
    src: url('/assets/fonts/PeydaWeb-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PeydaWeb';
    src: url('/assets/fonts/PeydaWeb-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'PeydaWeb', Tahoma, Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

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

.page {
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
}

.brand-mark,
.side-logo {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #111827;
    color: #ffffff;
    font-weight: 800;
    font-size: 24px;
}

h1 {
    font-size: 23px;
    margin: 0 0 6px;
    font-weight: 800;
}

h2 {
    font-size: 19px;
    margin: 0 0 8px;
    font-weight: 800;
}

p {
    margin: 0;
    color: #6b7280;
    line-height: 1.9;
}

.form {
    display: grid;
    gap: 10px;
}

.stack-form {
    max-width: 520px;
}

label {
    font-size: 13px;
    color: #374151;
    margin-top: 8px;
    font-weight: 500;
}

input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

input:focus {
    border-color: #111827;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 13px 16px;
    background: #111827;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
    font-weight: 700;
}

button.secondary {
    background: #e5e7eb;
    color: #111827;
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

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

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.note {
    margin-top: 18px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.8;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: #ffffff;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

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

.side-brand strong {
    display: block;
    font-size: 18px;
}

.side-brand span {
    display: block;
    color: #9ca3af;
    font-size: 13px;
    margin-top: 4px;
}

.side-logo {
    background: #ffffff;
    color: #111827;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: #d1d5db;
    font-size: 14px;
}

.side-nav a:hover,
.side-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

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

.side-logout button {
    width: 100%;
    background: #374151;
}

.main-area {
    min-width: 0;
}

.topbar {
    margin: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 22px;
}

.user-chip {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    color: #374151;
}

.content {
    padding: 24px;
}

.panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 18px;
}

.panel.narrow {
    max-width: 760px;
}

.panel-head {
    margin-bottom: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 20px;
}

.card strong {
    display: block;
    font-size: 30px;
    margin-bottom: 8px;
}

.card span {
    color: #6b7280;
    font-size: 14px;
}

.timeline {
    display: grid;
    gap: 10px;
    color: #374151;
}

.timeline div {
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

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

    .sidebar {
        position: static;
    }

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

    .topbar {
        display: block;
    }

    .user-chip {
        margin-top: 12px;
        display: inline-block;
    }
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 11px 14px;
    background: #111827;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.btn.secondary {
    background: #e5e7eb;
    color: #111827;
}

.filter-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 18px;
}

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

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    vertical-align: middle;
    font-size: 14px;
}

th {
    color: #4b5563;
    font-weight: 800;
    background: #f9fafb;
}

td small {
    display: block;
    color: #6b7280;
    margin-top: 4px;
}

.empty {
    text-align: center;
    color: #6b7280;
    padding: 24px;
}

.link {
    color: #2563eb;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 14px;
    align-items: center;
}

.form-grid .full,
.form-grid textarea.full,
.form-grid label.full {
    grid-column: 1 / -1;
}

select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    background: #ffffff;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.selected-box {
    padding: 14px;
    border-radius: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    margin: 16px 0;
}

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

.info-grid div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
}

.info-grid span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 6px;
}

.info-grid strong {
    display: block;
    color: #111827;
    font-size: 14px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form select {
    min-width: 150px;
}

.inline-form button {
    margin-top: 0;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .row-between {
        display: block;
    }

    .row-between .btn,
    .row-between .actions {
        margin-top: 12px;
    }

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

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

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

.btn.muted {
    background: #f3f4f6;
    color: #6b7280;
    cursor: default;
}

.muted-text {
    color: #9ca3af;
    font-size: 13px;
}

.table-wrap table form.inline-form button {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.chat-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 18px;
    align-items: start;
}

.chat-messages {
    display: grid;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.chat-message {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 18px;
    padding: 14px;
}

.chat-message.internal-note {
    background: #fff7ed;
    border-color: #fed7aa;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 12px;
}

.chat-message-meta strong {
    color: #111827;
    font-size: 13px;
}

.chat-message-meta em {
    background: #f97316;
    color: #ffffff;
    border-radius: 999px;
    padding: 3px 8px;
    font-style: normal;
}

.chat-message-body {
    line-height: 2;
    color: #111827;
    white-space: normal;
}

.chat-form {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.chat-form textarea {
    min-height: 120px;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #374151;
}

.check-row input {
    width: auto;
}

.chat-side h2 {
    margin-bottom: 14px;
}

.chat-participants {
    display: grid;
    gap: 10px;
}

.participant-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    background: #f9fafb;
}

.participant-item strong,
.participant-item span,
.participant-item em {
    display: block;
}

.participant-item span {
    margin-top: 5px;
    color: #6b7280;
    font-size: 12px;
}

.participant-item em {
    margin-top: 6px;
    color: #f97316;
    font-size: 12px;
    font-style: normal;
}

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

@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
}

.chat-attachments {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.chat-attachment {
    display: block;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 14px;
    padding: 10px 12px;
}

.chat-attachment strong,
.chat-attachment span {
    display: block;
}

.chat-attachment strong {
    color: #1d4ed8;
    font-size: 13px;
}

.chat-attachment span {
    color: #64748b;
    font-size: 12px;
    margin-top: 4px;
}

.menu-tree {
    display: grid;
    gap: 8px;
}

.menu-group {
    border-radius: 16px;
    overflow: hidden;
}

.menu-group summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 14px;
    color: #dbe4f0;
    font-weight: 800;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
}

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

.menu-group[open] summary {
    background: rgba(255,255,255,0.10);
    color: #ffffff;
}

.menu-group a {
    display: block;
    margin-top: 6px;
    padding: 10px 14px;
    border-radius: 14px;
    color: #cbd5e1;
    font-size: 13px;
}

.menu-group a.active,
.menu-group a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

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

.row-actions .inline-form {
    display: inline-flex;
}

.row-actions .inline-form button {
    margin: 0;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .row-actions {
        display: grid;
    }
}

.menu-tree {
    display: grid;
    gap: 8px;
}

.menu-group {
    border-radius: 16px;
    overflow: hidden;
}

.menu-group summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 14px;
    color: #dbe4f0;
    font-weight: 800;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
}

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

.menu-group[open] summary {
    background: rgba(255,255,255,0.10);
    color: #ffffff;
}

.menu-group a {
    display: block;
    margin-top: 6px;
    padding: 10px 14px;
    border-radius: 14px;
    color: #cbd5e1;
    font-size: 13px;
}

.menu-group a.active,
.menu-group a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

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

.row-actions .inline-form {
    display: inline-flex;
}

.row-actions .inline-form button,
.inline-form button {
    margin: 0;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .row-actions {
        display: grid;
    }
}

.date-fa,
.time-fa {
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: nowrap;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dash-card {
    display: block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 18px;
    min-height: 130px;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.06);
}

.dash-card span,
.dash-card small {
    display: block;
}

.dash-card span {
    color: #6b7280;
    font-size: 13px;
}

.dash-card strong {
    display: block;
    margin: 12px 0 8px;
    color: #111827;
    font-size: 32px;
    line-height: 1;
}

.dash-card small {
    color: #64748b;
    font-size: 12px;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

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

.list-item {
    display: block;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 16px;
    padding: 13px;
}

.list-item strong,
.list-item span,
.list-item small {
    display: block;
}

.list-item strong {
    color: #111827;
    margin-bottom: 6px;
}

.list-item span {
    color: #64748b;
    font-size: 12px;
}

.list-item small {
    color: #475569;
    margin-top: 8px;
    line-height: 1.8;
}

.list-item em {
    display: inline-block;
    margin-right: 8px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 999px;
    padding: 2px 8px;
    font-style: normal;
}

@media (max-width: 1200px) {
    .dash-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 700px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dash-card {
    display: block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 18px;
    min-height: 130px;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.06);
}

.dash-card span,
.dash-card small {
    display: block;
}

.dash-card span {
    color: #6b7280;
    font-size: 13px;
}

.dash-card strong {
    display: block;
    margin: 12px 0 8px;
    color: #111827;
    font-size: 32px;
    line-height: 1;
}

.dash-card small {
    color: #64748b;
    font-size: 12px;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

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

.list-item {
    display: block;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 16px;
    padding: 13px;
}

.list-item strong,
.list-item span,
.list-item small {
    display: block;
}

.list-item strong {
    color: #111827;
    margin-bottom: 6px;
}

.list-item span {
    color: #64748b;
    font-size: 12px;
}

.list-item small {
    color: #475569;
    margin-top: 8px;
    line-height: 1.8;
}

.list-item em {
    display: inline-block;
    margin-right: 8px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 999px;
    padding: 2px 8px;
    font-style: normal;
}

@media (max-width: 1200px) {
    .dash-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 700px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

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

.top-global-search input {
    min-width: 240px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 0 16px;
}

.top-global-search button {
    height: 42px;
    border-radius: 999px;
    padding: 0 16px;
}

.global-search-page {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.global-search-page input {
    flex: 1;
}

.search-results {
    display: grid;
    gap: 10px;
}

.search-result-item {
    display: grid;
    grid-template-columns: 130px 1fr 2fr 140px;
    gap: 12px;
    align-items: center;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 16px;
    padding: 12px;
}

.search-result-item span {
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
}

.search-result-item strong {
    color: #111827;
}

.search-result-item small {
    color: #64748b;
    line-height: 1.8;
}

.search-result-item em {
    color: #475569;
    font-style: normal;
    direction: ltr;
    unicode-bidi: plaintext;
}

@media (max-width: 900px) {
    .topbar {
        align-items: stretch;
    }

    .top-global-search,
    .global-search-page {
        max-width: none;
        display: grid;
    }

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