:root {
    --tc-bg: #f4f6fb;
    --tc-surface: #ffffff;
    --tc-surface-2: #f8fafc;
    --tc-border: #e2e8f0;
    --tc-text: #0f172a;
    --tc-muted: #64748b;
    --tc-primary: #1d4ed8;
    --tc-primary-dark: #1e40af;
    --tc-sidebar: #0f172a;
    --tc-sidebar-text: #cbd5e1;
    --tc-sidebar-active: #1d4ed8;
    --tc-danger: #dc2626;
    --tc-danger-bg: #fef2f2;
    --tc-warn: #b45309;
    --tc-warn-bg: #fffbeb;
    --tc-ok: #15803d;
    --tc-ok-bg: #f0fdf4;
    --tc-info-bg: #eff6ff;
    --tc-radius: 10px;
    --tc-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--tc-bg);
    color: var(--tc-text);
    font-size: 14px;
    line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .25rem; }
a { color: var(--tc-primary); text-decoration: none; }
code { font-family: "Cascadia Code", Consolas, monospace; }

.tc-muted { color: var(--tc-muted); }
.tc-nowrap { white-space: nowrap; }
.tc-center { text-align: center; padding: 2.5rem 1rem; }

/* ---- Shell ---- */
.tc-shell { display: flex; min-height: 100vh; }
.tc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.tc-sidebar {
    width: 240px;
    background: var(--tc-sidebar);
    color: var(--tc-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.tc-brand { display: flex; align-items: center; gap: .6rem; padding: 1.15rem 1.25rem; }
.tc-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--tc-primary); color: #fff; font-weight: 700; letter-spacing: .5px;
}
.tc-brand-text { display: flex; flex-direction: column; font-weight: 600; color: #fff; line-height: 1.15; }
.tc-brand-text small { font-weight: 400; font-size: .72rem; color: var(--tc-sidebar-text); }
.tc-brand-lg .tc-brand-mark { width: 44px; height: 44px; font-size: 1.15rem; }

.tc-nav { list-style: none; margin: .5rem 0 0; padding: 0 .5rem; flex: 1; }
.tc-nav li { margin: 2px 0; }
.tc-nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .75rem; border-radius: 8px;
    color: var(--tc-sidebar-text); font-weight: 500;
}
.tc-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.tc-nav-link.active { background: var(--tc-sidebar-active); color: #fff; }
.tc-nav-icon { width: 1.25rem; text-align: center; }
.tc-nav-label { flex: 1; }

.tc-sidebar-foot { padding: 1rem 1.25rem; font-size: .75rem; border-top: 1px solid rgba(255, 255, 255, .07); }

/* ---- Topbar ---- */
.tc-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--tc-surface); border-bottom: 1px solid var(--tc-border);
    padding: .85rem 1.5rem;
}
.tc-topbar-title { font-weight: 600; }
.tc-user { display: flex; align-items: center; gap: .85rem; }
.tc-user-name { font-weight: 600; }

.tc-content { padding: 1.5rem; flex: 1; }

/* ---- Page head ---- */
.tc-page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.tc-actions, .tc-filters-actions { display: flex; gap: .5rem; align-items: center; }

/* ---- Buttons ---- */
.tc-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--tc-border);
    background: var(--tc-surface); color: var(--tc-text); font-weight: 600; font-size: .85rem;
    cursor: pointer; transition: background .12s, border-color .12s, opacity .12s;
}
.tc-btn:hover:not(:disabled) { background: var(--tc-surface-2); }
.tc-btn:disabled { opacity: .55; cursor: not-allowed; }
.tc-btn-primary { background: var(--tc-primary); border-color: var(--tc-primary); color: #fff; }
.tc-btn-primary:hover:not(:disabled) { background: var(--tc-primary-dark); }
.tc-btn-ghost { background: transparent; }
.tc-btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.tc-btn-block { width: 100%; }

/* ---- Cards ---- */
.tc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tc-card {
    background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
    padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .25rem; box-shadow: var(--tc-shadow);
}
.tc-card-value { font-size: 1.9rem; font-weight: 700; }
.tc-card-label { color: var(--tc-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.tc-card-alert { border-left: 4px solid var(--tc-danger); }
.tc-card-alert .tc-card-value { color: var(--tc-danger); }

/* ---- Panel ---- */
.tc-panel {
    background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow); overflow: hidden;
}
.tc-panel-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--tc-border); background: var(--tc-surface-2); }
.tc-panel-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tc-panel-head-flex h2 { font-size: 1rem; }

/* ---- Dashboard ---- */
.tc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.tc-link-more { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tc-feed { list-style: none; margin: 0; padding: 0; }
.tc-feed-item { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--tc-border); }
.tc-feed-item:last-child { border-bottom: none; }
.tc-feed-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.tc-feed-msg { font-weight: 500; word-break: break-word; }
.tc-feed-meta { font-size: .76rem; }
.tc-feed-foot { padding: .7rem 1.25rem; border-top: 1px solid var(--tc-border); background: var(--tc-surface-2); }

/* ---- Filters ---- */
.tc-filters { display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end; }
.tc-field-inline { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--tc-muted); font-weight: 600; }
.tc-field-inline .tc-input { min-width: 150px; }

/* ---- Inputs ---- */
.tc-input {
    padding: .5rem .65rem; border: 1px solid var(--tc-border); border-radius: 8px;
    background: var(--tc-surface); color: var(--tc-text); font-size: .88rem; font-weight: 500;
}
.tc-input:focus { outline: 2px solid rgba(29, 78, 216, .35); outline-offset: 1px; border-color: var(--tc-primary); }

/* ---- Table ---- */
.tc-table-wrap { overflow-x: auto; }
.tc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tc-table thead th {
    text-align: left; padding: .7rem 1rem; color: var(--tc-muted); font-weight: 600;
    text-transform: uppercase; font-size: .72rem; letter-spacing: .04em;
    border-bottom: 1px solid var(--tc-border); background: var(--tc-surface-2); position: sticky; top: 0;
}
.tc-table tbody td { padding: .7rem 1rem; border-bottom: 1px solid var(--tc-border); vertical-align: top; }
.tc-table tbody tr:hover { background: var(--tc-surface-2); }
.tc-cell-msg { max-width: 420px; }
.tc-col-action { text-align: right; white-space: nowrap; }
.tc-code { background: var(--tc-surface-2); border: 1px solid var(--tc-border); border-radius: 5px; padding: .1rem .4rem; font-size: .8rem; }

/* ---- Pills / badges / status ---- */
.tc-pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.tc-sev-high { background: var(--tc-danger-bg); color: var(--tc-danger); }
.tc-sev-med { background: var(--tc-warn-bg); color: var(--tc-warn); }
.tc-sev-low { background: var(--tc-info-bg); color: var(--tc-primary); }

.tc-status { display: inline-block; padding: .15rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 600; }
.tc-status-active { background: var(--tc-danger-bg); color: var(--tc-danger); }
.tc-status-resolue { background: var(--tc-ok-bg); color: var(--tc-ok); }
.tc-status-ignoree { background: var(--tc-surface-2); color: var(--tc-muted); }
.tc-status-ouverte { background: var(--tc-warn-bg); color: var(--tc-warn); }
.tc-status-acceptee { background: var(--tc-ok-bg); color: var(--tc-ok); }
.tc-status-rejetee { background: var(--tc-surface-2); color: var(--tc-muted); }

/* Réclamation ouverte mise en évidence */
.tc-row-open > td:first-child { box-shadow: inset 3px 0 0 var(--tc-warn); }
.tc-row-selected > td { background: var(--tc-info-bg); }
.tc-row-click { cursor: pointer; }
.tc-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.tc-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .85rem 1.5rem; margin: .5rem 0 1rem; }
.tc-detail-grid dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--tc-muted); margin-bottom: .15rem; }
.tc-detail-grid dd { margin: 0; font-size: .88rem; word-break: break-word; }
.tc-resolve { border-top: 1px dashed var(--tc-border); padding-top: 1rem; }
.tc-radio-row { display: flex; gap: 1.25rem; margin: .5rem 0 .85rem; }
.tc-radio-row label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; cursor: pointer; }
.tc-textarea { min-height: 72px; resize: vertical; width: 100%; font-family: inherit; }

.tc-badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 600; }
.tc-badge-soon { background: var(--tc-warn-bg); color: var(--tc-warn); }
.tc-chip { display: inline-block; margin-left: .35rem; padding: .05rem .4rem; border-radius: 5px; background: var(--tc-surface-2); border: 1px solid var(--tc-border); font-size: .72rem; }

/* ---- Alerts (inline messages) ---- */
.tc-alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; font-size: .88rem; }
.tc-alert-error { background: var(--tc-danger-bg); color: var(--tc-danger); border: 1px solid #fecaca; }
.tc-alert-info { background: var(--tc-info-bg); color: var(--tc-primary-dark); border: 1px solid #bfdbfe; }

/* ---- Empty / placeholder ---- */
.tc-empty { text-align: center; padding: 3rem 1rem; color: var(--tc-muted); }
.tc-empty-icon { font-size: 2rem; display: block; margin-bottom: .5rem; }
.tc-placeholder { padding: 3rem 2rem; text-align: center; }
.tc-placeholder .tc-empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.tc-placeholder p { max-width: 620px; margin: .5rem auto 0; }

/* ---- Diff / detail ---- */
.tc-detail-row td { background: var(--tc-surface-2); }
.tc-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tc-diff-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--tc-muted); }
.tc-pre { margin: .3rem 0 0; padding: .6rem; background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: 6px; font-size: .78rem; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }

/* ---- Pagination ---- */
.tc-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--tc-border); background: var(--tc-surface-2); }
.tc-page-indicator { font-weight: 600; font-size: .82rem; }

/* ---- Auth ---- */
.tc-auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); }
.tc-auth-card { width: 100%; max-width: 400px; background: var(--tc-surface); border-radius: 14px; padding: 2rem; box-shadow: 0 20px 45px rgba(15, 23, 42, .35); }
.tc-auth-card .tc-brand { padding: 0 0 1rem; justify-content: center; }
.tc-auth-title { margin: .5rem 0 .25rem; }
.tc-field { display: flex; flex-direction: column; gap: .35rem; margin: 1rem 0; font-weight: 600; font-size: .85rem; }
.tc-field .tc-input { font-size: .95rem; }

/* ---- Validation ---- */
.validation-message { color: var(--tc-danger); font-size: .78rem; font-weight: 500; }

@media (max-width: 720px) {
    .tc-sidebar { width: 64px; }
    .tc-brand-text, .tc-nav-label, .tc-sidebar-foot, .tc-badge { display: none; }
    .tc-diff { grid-template-columns: 1fr; }
}
