/* Tickets Farabi - main styles */
:root {
    --app-primary: #0f5c6e;
    --app-primary-dark: #0a4352;
    --app-bg: #f4f6f8;
    --app-border: #dfe4e8;
    --app-text-muted: #6b7780;
}

html, body { height: 100%; }

body {
    background: var(--app-bg);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 0.95rem;
    color: #1f2a30;
    display: flex;
    flex-direction: column;
}

#MainForm { flex: 1 0 auto; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

.app-navbar { background: var(--app-primary); }
.app-navbar .nav-link { color: rgba(255,255,255,.85); }
.app-navbar .nav-link:hover, .app-navbar .nav-link.active { color: #fff; }

.brand-mark {
    display: inline-block;
    background: #fff;
    color: var(--app-primary);
    font-weight: 700;
    font-size: .8rem;
    border-radius: 6px;
    padding: 2px 6px;
    margin-right: 6px;
}

.page-title { font-size: 1.4rem; font-weight: 600; margin: 0; }

.app-card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: none;
}
.app-card .card-header {
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid var(--app-border);
}

.stat-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 16px 18px;
}
.stat-label { color: var(--app-text-muted); font-size: .85rem; }
.stat-value { font-size: 1.8rem; font-weight: 600; }

.btn-primary { background: var(--app-primary); border-color: var(--app-primary); }
.btn-primary:hover { background: var(--app-primary-dark); border-color: var(--app-primary-dark); }

.app-footer {
    text-align: center;
    color: var(--app-text-muted);
    font-size: .8rem;
    padding: 14px 0;
    border-top: 1px solid var(--app-border);
    background: #fff;
}

.stat-accent { border-left: 4px solid var(--app-primary); }

/* ---------- Login page ---------- */
.login-body {
    background: linear-gradient(160deg, #0f5c6e 0%, #0a4352 55%, #f4f6f8 55%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrap { width: 100%; max-width: 400px; padding: 16px; }
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.login-logo {
    width: 54px; height: 54px; line-height: 54px;
    margin: 0 auto 10px;
    border-radius: 12px;
    background: var(--app-primary);
    color: #fff; font-weight: 700; font-size: 1.2rem;
}
.login-title { font-size: 1.35rem; font-weight: 600; margin: 0; }

/* ---------- Tickets ---------- */
.clickable { cursor: pointer; }
.tickets-table th { font-size: .8rem; color: var(--app-text-muted); font-weight: 600; white-space: nowrap; }
.tickets-table a { text-decoration: none; }

.mode-list label { margin-left: 6px; }
.mode-list input { margin-top: 4px; }
.mode-list br + input { margin-top: 8px; }
.receivers-box {
    max-height: 220px; overflow-y: auto;
    border: 1px solid var(--app-border); border-radius: 8px; padding: 8px 12px;
}
.receivers-box label { margin-left: 6px; }

/* Conversation */
.msg {
    background: #fff;
    border: 1px solid var(--app-border);
    border-left: 4px solid #adb5bd;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.msg-client   { border-left-color: #0d6efd; }
.msg-farabi   { border-left-color: var(--app-primary); background: #f3f9fa; }
.msg-internal { border-left-color: #ffc107; background: #fffbea; }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.msg-body { white-space: normal; line-height: 1.55; word-wrap: break-word; }
.msg-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip {
    display: inline-block; font-size: .8rem; text-decoration: none;
    border: 1px solid var(--app-border); border-radius: 20px; padding: 3px 10px; background: #fff;
}
.file-chip:hover { background: #eef4f6; }

.details dt { font-weight: 600; color: var(--app-text-muted); font-size: .75rem; text-transform: uppercase; margin-top: 8px; }
.details dt:first-child { margin-top: 0; }
.details dd { margin-bottom: 0; }
.file-chip a { text-decoration: none; }
.file-dl { margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--app-border); white-space: nowrap; }

/* ---------- Reports & printing ---------- */
.num { text-align: right; white-space: nowrap; }
.report-table th { font-size: .78rem; background: #f1f4f6; white-space: nowrap; }
.report-table td { font-size: .85rem; }
.report-head {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
    border-bottom: 2px solid var(--app-primary); padding-bottom: 8px; margin-bottom: 14px;
}
.report-org { color: var(--app-primary); font-weight: 700; font-size: 1.05rem; }
.report-title { font-weight: 600; font-size: 1.2rem; }
.print-page { max-width: 900px; margin: 0 auto; padding: 24px; }
.print-subject { font-size: 1.25rem; font-weight: 600; margin: 6px 0 12px; }
.print-section { font-size: 1rem; font-weight: 600; margin: 18px 0 8px; color: var(--app-primary); }
.print-details th { width: 16%; background: #f1f4f6; font-weight: 600; font-size: .85rem; }
.print-details td { font-size: .9rem; }
.print-foot { display: none; }

@media print {
    .app-navbar, .app-footer, .no-print, .btn { display: none !important; }
    body, #MainForm, main { background: #fff !important; }
    main { padding: 0 !important; }
    .print-page { padding: 0; max-width: none; }
    .card, .app-card { border: none !important; }
    a { color: inherit !important; text-decoration: none !important; }
    .msg { break-inside: avoid; }
    .report-table th, .report-table td { font-size: 9.5pt; }
    .table-responsive { overflow: visible !important; }
    .print-foot { display: block; text-align: center; font-size: 8pt; color: #888; margin-top: 16px; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
