:root {
    --tk-primary: #0F766E;
    --tk-primary-600: #0d665f;
    --tk-primary-soft: #ccfbf1;
    --tk-accent: #2DD4BF;
    --tk-coral: #FF7A59;
    --tk-ink: #1F2937;
    --tk-muted: #64748b;
    --tk-bg: #F8FAFC;
    --tk-surface: #ffffff;
    --tk-border: #e2e8f0;
    --tk-danger: #dc2626;
    --tk-warning: #d97706;
    --tk-success: #16a34a;
    --tk-info: #2563eb;
    --tk-radius-sm: 10px;
    --tk-radius: 16px;
    --tk-radius-lg: 24px;
    --tk-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    --tk-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --tk-shadow-strong: 0 24px 60px rgba(15, 118, 110, 0.18);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, 0.16), transparent 34rem),
        linear-gradient(180deg, #f8fafc 0%, #eefdfa 100%);
    color: var(--tk-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body {
    font-family: "Tahoma", "Arial", ui-sans-serif, system-ui, sans-serif;
}

a {
    color: var(--tk-primary);
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

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

button {
    touch-action: manipulation;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
    padding: 24px 0;
}

.page-title, h1, h2, h3 {
    color: #0f172a;
}

.card {
    background: var(--tk-surface);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: var(--tk-radius-lg);
    padding: 22px;
    box-shadow: var(--tk-shadow-sm);
}

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

.stat {
    margin-top: 8px;
    color: #0f172a;
    font-size: clamp(26px, 6vw, 34px);
    font-weight: 950;
    letter-spacing: -0.05em;
}

.btn,
button.btn,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 850;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

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

.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(45, 212, 191, 0.35);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--tk-primary);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.20);
}

.btn-primary:hover {
    background: var(--tk-primary-600);
}

.btn-secondary {
    background: #ffffff;
    color: var(--tk-ink);
    border-color: var(--tk-border);
}

.btn-secondary:hover {
    border-color: rgba(15, 118, 110, 0.28);
    color: var(--tk-primary);
}

.btn-danger {
    background: var(--tk-danger);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.16);
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 14px;
    font-weight: 850;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea,
.admin-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

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

input:focus,
select:focus,
textarea:focus,
.admin-input:focus {
    border-color: var(--tk-primary);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16);
    outline: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--tk-border);
    text-align: start;
    vertical-align: top;
}

th {
    color: #475569;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.flash,
.flash-success {
    margin-bottom: 16px;
    border: 1px solid #99f6e4;
    border-radius: var(--tk-radius);
    background: #ecfdf5;
    color: #065f46;
    padding: 13px 15px;
    font-weight: 750;
}

.errors,
.flash-errors {
    margin-bottom: 16px;
    border: 1px solid #fecaca;
    border-radius: var(--tk-radius);
    background: #fef2f2;
    color: #991b1b;
    padding: 13px 15px;
}

.errors ul,
.flash-errors ul {
    margin: 8px 0 0;
    padding-inline-start: 20px;
}

.empty-state {
    padding: 32px 22px;
    color: var(--tk-muted);
    text-align: center;
    line-height: 1.7;
}

/* Main authenticated/public shell */
.tk-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(226, 232, 240, 0.86);
    backdrop-filter: blur(16px);
}

.tk-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.tk-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
    text-decoration: none;
    font-size: 20px;
    font-weight: 950;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

.tk-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--tk-primary), var(--tk-accent));
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.tk-nav-links,
.tk-nav-actions,
.tk-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tk-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 999px;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.tk-nav-link:hover,
.tk-nav-link.is-active {
    background: var(--tk-primary-soft);
    color: var(--tk-primary);
}

.locale-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.locale-pill,
.locale-link,
.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid var(--tk-border);
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.locale-pill.is-active,
.locale-link.is-active,
.lang-pill.active {
    border-color: var(--tk-primary);
    background: var(--tk-primary);
    color: #ffffff;
}

.tk-main {
    padding-bottom: 42px;
}

/* Super-admin shell */
.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding: 10px 0 48px;
}

.admin-sidebar {
    position: sticky;
    top: 88px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: var(--tk-radius-lg);
    padding: 18px;
    box-shadow: var(--tk-shadow-sm);
    backdrop-filter: blur(12px);
}

.admin-sidebar-title {
    margin-bottom: 14px;
    color: var(--tk-muted);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

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

.admin-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 11px 14px;
    border-radius: 14px;
    background: #f8fafc;
    color: #334155;
    font-weight: 900;
    text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--tk-primary);
    color: #ffffff;
    box-shadow: 0 12px 26px rgba(15, 118, 110, 0.18);
}

.admin-content {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.admin-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-radius: 28px;
    padding: clamp(22px, 4vw, 32px);
    background:
        radial-gradient(circle at top right, rgba(255, 122, 89, 0.35), transparent 18rem),
        linear-gradient(135deg, #0f766e 0%, #115e59 48%, #1f2937 100%);
    color: #ffffff;
    box-shadow: var(--tk-shadow-strong);
}

.admin-hero h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1;
    letter-spacing: -0.055em;
}

.admin-hero p {
    max-width: 760px;
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.7;
}

.admin-hero-actions {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-hero-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.admin-hero-link:hover {
    background: rgba(255, 255, 255, 0.24);
}

.section-card {
    overflow: hidden;
    background: var(--tk-surface);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 26px;
    box-shadow: var(--tk-shadow-sm);
}

.section-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--tk-border);
    background: #ffffff;
}

.section-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
    letter-spacing: -0.035em;
}

.section-header p {
    margin: 6px 0 0;
    color: var(--tk-muted);
    font-size: 14px;
    line-height: 1.65;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 15px 18px;
    border-bottom: 1px solid #edf2f7;
    text-align: start;
    vertical-align: top;
}

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-table td {
    color: #0f172a;
    font-size: 14px;
    line-height: 1.55;
}

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

.stat-card {
    background: #ffffff;
    border: 1px solid var(--tk-border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--tk-shadow-sm);
}

.stat-label {
    margin-bottom: 8px;
    color: var(--tk-muted);
    font-size: 13px;
    font-weight: 900;
}

.stat-value {
    color: #0f172a;
    font-size: 34px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.04em;
}

.cell-main {
    color: #0f172a;
    font-weight: 950;
}

.cell-sub,
.muted {
    margin-top: 3px;
    color: var(--tk-muted);
    font-size: 13px;
}

.pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 950;
    white-space: nowrap;
}

.pill-green {
    background: #dcfce7;
    color: #166534;
}

.pill-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.pill-red {
    background: #fee2e2;
    color: #991b1b;
}

.pill-yellow {
    background: #fef9c3;
    color: #854d0e;
}

.admin-form {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.admin-button,
.admin-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    background: var(--tk-primary);
    color: #ffffff;
    font-size: 13px;
    font-weight: 950;
    text-decoration: none;
    cursor: pointer;
}

.admin-button:hover {
    background: var(--tk-primary-600);
}

.admin-link-button {
    background: #e2e8f0;
    color: #0f172a;
}

.admin-name-link,
.admin-inline-link {
    color: var(--tk-primary);
    text-decoration: none;
    font-weight: 950;
}

.admin-name-link:hover,
.admin-inline-link:hover {
    text-decoration: underline;
}

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

.detail-list {
    display: grid;
    gap: 0;
    padding: 4px 24px 16px;
}

.detail-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(0, 1.3fr);
    gap: 16px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid #edf2f7;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row span:first-child {
    color: var(--tk-muted);
    font-size: 13px;
    font-weight: 950;
}

.detail-row strong {
    color: #0f172a;
    font-size: 14px;
    line-height: 1.55;
}

.ticket-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 20px 24px 24px;
}

.mini-stat-card {
    background: #f8fafc;
    border: 1px solid var(--tk-border);
    border-radius: 18px;
    padding: 18px;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--tk-border);
    background: #ffffff;
}

.admin-filters .filter-wide {
    grid-column: span 2;
}

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

.result-count {
    padding: 0 24px 16px;
    color: var(--tk-muted);
    font-size: 13px;
    font-weight: 850;
}

@media (max-width: 980px) {
    .tk-nav-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .tk-nav-group,
    .tk-nav-actions,
    .tk-nav-links {
        width: 100%;
    }

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

    .admin-sidebar {
        position: static;
    }

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

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

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

    .admin-filters .filter-wide {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 24px, 1120px);
        padding: 16px 0;
    }

    .card,
    .section-card,
    .admin-hero {
        border-radius: 20px;
    }

    .tk-brand {
        font-size: 18px;
    }

    .tk-nav-link,
    .btn,
    button.btn,
    a.btn {
        width: 100%;
    }

    .tk-nav-links,
    .tk-nav-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .admin-nav,
    .stats-grid,
    .detail-grid,
    .ticket-summary-grid,
    .admin-filters {
        grid-template-columns: 1fr;
    }

    .admin-filters .filter-wide {
        grid-column: span 1;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .admin-table {
        min-width: 760px;
    }
}

@media print {
    .tk-nav,
    .admin-sidebar,
    .admin-hero-actions {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .card,
    .section-card,
    .stat-card {
        box-shadow: none;
    }
}
