/* Chatcentral - centralens brugerflade.
   Roligt, professionelt standarddesign. Ingen eksterne fonte eller billeder (K17). */

:root {
    --cc-bg: #f2f4f7;
    --cc-panel: #ffffff;
    --cc-border: #d8dce3;
    --cc-text: #1b1f24;
    --cc-muted: #5b6270;
    --cc-accent: #1f4e79;
    --cc-accent-dark: #163a5a;
    --cc-danger: #a5251c;
    --cc-warning: #8a5a00;
    --cc-ok: #1e6b40;
    --cc-radius: 10px;
}

* { box-sizing: border-box; }

/* Attributten hidden skal altid vinde. Uden denne regel overskrev klasser med
   display: flex/grid/block den, så skjulte elementer blev vist alligevel:
   en tom dialog ved login, sidepanel og svarfelt uden valgt samtale, og både
   indbakke og administration på samme side (fundet af ejeren i Chrome). */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--cc-text);
    background: var(--cc-bg);
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--cc-muted); margin-top: 18px; }

.cc-muted { color: var(--cc-muted); }
.cc-small { font-size: 13px; }
.cc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ login */

.cc-login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.cc-login { background: var(--cc-panel); border: 1px solid var(--cc-border); border-radius: var(--cc-radius);
    padding: 28px; width: 100%; max-width: 380px; }
.cc-login label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: 14px; }
.cc-login input { width: 100%; }
.cc-login button { width: 100%; margin-top: 18px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    font-size: 15px;
    color: var(--cc-text);
    background: #fff;
    border: 1px solid #c3c8d1;
    border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cc-accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; }

.cc-error { color: var(--cc-danger); font-size: 14px; margin: 12px 0 0; }

/* ----------------------------------------------------------------- knapper */

.cc-btn {
    font: inherit; font-size: 14px; font-weight: 600;
    padding: 8px 14px; border-radius: 8px;
    border: 1px solid #c3c8d1; background: #fff; color: var(--cc-text);
    cursor: pointer;
}
.cc-btn:hover { background: #f3f5f8; }
.cc-btn:focus-visible { outline: 3px solid var(--cc-accent); outline-offset: 2px; }
.cc-btn:disabled { opacity: .5; cursor: not-allowed; }
.cc-btn-primary { background: var(--cc-accent); border-color: var(--cc-accent); color: #fff; }
.cc-btn-primary:hover { background: var(--cc-accent-dark); }
.cc-btn-danger { background: #fff; border-color: var(--cc-danger); color: var(--cc-danger); }
.cc-btn-warning { background: #fff8e8; border-color: #d9ab4a; color: var(--cc-warning); }
.cc-textbtn { background: none; border: 0; font: inherit; font-size: 14px; color: #dbe6f2;
    text-decoration: underline; cursor: pointer; padding: 4px; }
.cc-textbtn:focus-visible { outline: 2px solid #fff; }
/* På chatvagt uden lyd: skal kunne ses fra den anden ende af skærmen. */
.cc-textbtn.is-warning { background: #ffd24d; color: #3d2a00; text-decoration: none;
    font-weight: 700; border-radius: 6px; padding: 6px 10px; }
.cc-textbtn.is-warning:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------------------------------------------------------------- topbjælke */

.cc-topbar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--cc-accent); color: #fff; padding: 10px 16px;
}
.cc-brand { font-weight: 700; font-size: 17px; }
.cc-shift { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Primærknapper i den blå topbjælke skal kunne ses: hvid knap med blå tekst. */
.cc-topbar .cc-btn-primary { background: #fff; border-color: #fff; color: var(--cc-accent); }
.cc-topbar .cc-btn-primary:hover { background: #e8eef5; }
.cc-state { font-size: 14px; background: rgba(255,255,255,.16); padding: 4px 10px; border-radius: 999px; }
.cc-state.is-accepting { background: #1e6b40; }
.cc-state.is-paused { background: #8a5a00; }
.cc-state.is-expired { background: #a5251c; }
.cc-state.is-off { background: rgba(255,255,255,.2); }
.cc-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cc-nav a { color: #dbe6f2; text-decoration: none; font-size: 14px; font-weight: 600; padding: 4px 2px; }
.cc-nav a.is-active { color: #fff; border-bottom: 2px solid #fff; }
.cc-nav a:focus-visible { outline: 2px solid #fff; }

.cc-banner { padding: 8px 16px; font-size: 14px; background: #fdeceb; color: #7a1f1a; border-bottom: 1px solid #f3c3c0; }
.cc-banner.is-ok { background: #e8f5ec; color: #14532d; border-bottom-color: #bfe0cb; }
.cc-banner.is-warning { background: #fff6e0; color: #59470f; border-bottom-color: #f0dcae; }

/* ------------------------------------------------------------------ layout */

.cc-main {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(260px, 320px);
    gap: 12px;
    padding: 12px;
    height: calc(100vh - 56px);
}
.cc-main.cc-admin { display: block; height: auto; min-height: calc(100vh - 56px); }

.cc-list, .cc-thread, .cc-side {
    background: var(--cc-panel); border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius); overflow: hidden; display: flex; flex-direction: column;
}
.cc-side { padding: 14px; overflow-y: auto; display: block; }
.cc-side label { display: block; margin: 8px 0 3px; font-size: 13px; font-weight: 600; }
.cc-side .cc-btn { margin-top: 8px; }

.cc-filters { display: grid; gap: 6px; padding: 10px; border-bottom: 1px solid var(--cc-border); }
.cc-capacity { margin: 0; padding: 6px 10px; font-size: 13px; color: var(--cc-muted);
    border-bottom: 1px solid var(--cc-border); background: #fafbfc; }

.cc-conversations { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.cc-conversations li { border-bottom: 1px solid #edeff3; }
.cc-conv {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 10px 12px; cursor: pointer; font: inherit;
}
.cc-conv:hover { background: #f4f6f9; }
.cc-conv.is-active { background: #e7effa; box-shadow: inset 3px 0 0 var(--cc-accent); }
.cc-conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cc-conv-site { font-weight: 700; font-size: 14px; }
.cc-conv-time { font-size: 12px; color: var(--cc-muted); white-space: nowrap; }
.cc-conv-preview { font-size: 13.5px; color: #40454d; margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.cc-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
    background: #e5e8ee; color: #3c424b; border-radius: 4px; padding: 1px 6px; }
.cc-tag.is-waiting { background: #fff0cf; color: #6b5100; }
.cc-tag.is-mine { background: #dcecff; color: #14395e; }
.cc-tag.is-takeover { background: #ffe0dd; color: #7a1f1a; }
.cc-tag.is-unread { background: var(--cc-danger); color: #fff; }
.cc-tag.is-hot { background: #ffd9d4; color: #7a1f1a; }
.cc-tag.is-lukewarm { background: #ffeccc; color: #6b4a00; }
.cc-tag.is-irrelevant { background: #e5e8ee; color: #4a505a; }

/* ------------------------------------------------------------------ tråd */

.cc-thread-inner { display: flex; flex-direction: column; height: 100%; }
.cc-thread-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-bottom: 1px solid var(--cc-border); }
.cc-thread-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cc-empty { padding: 40px 20px; text-align: center; color: var(--cc-muted); }

.cc-messages { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column;
    gap: 10px; background: #f7f8fa; }
.cc-msg { max-width: 78%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap;
    overflow-wrap: anywhere; }
.cc-msg-visitor { align-self: flex-start; background: #fff; border: 1px solid var(--cc-border);
    border-bottom-left-radius: 4px; }
.cc-msg-agent { align-self: flex-end; background: var(--cc-accent); color: #fff; border-bottom-right-radius: 4px; }
.cc-msg-system { align-self: center; background: #ebedf1; border: 1px solid #dcdfe4; color: #3a3f47;
    font-size: 13.5px; max-width: 92%; }
.cc-msg-meta { font-size: 11.5px; opacity: .78; margin-top: 4px; }
.cc-msg a { color: inherit; }

.cc-typing-line { margin: 0; padding: 4px 14px; font-size: 13px; color: var(--cc-muted); background: #f7f8fa; }
.cc-reply { border-top: 1px solid var(--cc-border); padding: 10px; background: #fff; }
.cc-reply-row { display: flex; gap: 8px; align-items: flex-end; }
.cc-reply-row textarea { flex: 1 1 auto; }
.cc-notice { margin: 0 0 8px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px;
    background: #fff6e0; color: #59470f; border: 1px solid #f0dcae; }

.cc-facts { margin: 0; font-size: 14px; }
.cc-facts dt { color: var(--cc-muted); font-size: 12.5px; margin-top: 7px; }
.cc-facts dd { margin: 0; }

.cc-leadbox { display: flex; gap: 6px; flex-wrap: wrap; }
.cc-lead { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 999px;
    border: 1px solid #c3c8d1; background: #fff; cursor: pointer; }
.cc-lead.is-active { background: var(--cc-accent); border-color: var(--cc-accent); color: #fff; }

.cc-notes { list-style: none; margin: 0; padding: 0; }
.cc-notes li { background: #f7f8fa; border: 1px solid var(--cc-border); border-radius: 8px;
    padding: 8px 10px; margin-bottom: 6px; font-size: 13.5px; white-space: pre-wrap; }
.cc-notes .cc-note-meta { font-size: 11.5px; color: var(--cc-muted); margin-top: 4px; }

/* ---------------------------------------------------------------- admin */

.cc-admin-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 12px 0; }
.cc-tab { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px;
    border: 1px solid var(--cc-border); border-bottom: 0; border-radius: 8px 8px 0 0;
    background: #e9ecf1; cursor: pointer; }
.cc-tab.is-active { background: var(--cc-panel); }
.cc-admin-body { background: var(--cc-panel); border: 1px solid var(--cc-border);
    border-radius: 0 var(--cc-radius) var(--cc-radius) var(--cc-radius); margin: 0 12px 12px; padding: 16px; }

table.cc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cc-table th, table.cc-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e8eaef;
    vertical-align: top; }
table.cc-table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--cc-muted); }
code.cc-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
    background: #eef0f4; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

.cc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cc-card { border: 1px solid var(--cc-border); border-radius: var(--cc-radius); padding: 12px; }
.cc-badge-ok { color: var(--cc-ok); font-weight: 700; }
.cc-badge-bad { color: var(--cc-danger); font-weight: 700; }

/* ---------------------------------------------------------------- modal */

.cc-modal { position: fixed; inset: 0; background: rgba(15, 20, 28, .45); display: flex;
    align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.cc-modal-card { background: #fff; border-radius: var(--cc-radius); padding: 18px; width: 100%;
    max-width: 460px; max-height: 88vh; overflow-y: auto; }
.cc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ------------------------------------------------------------- responsivt */

@media (max-width: 1100px) {
    .cc-main { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); height: auto; }
    .cc-side { grid-column: 1 / -1; }
    .cc-conversations { max-height: 45vh; }
    .cc-messages { min-height: 45vh; }
}

@media (max-width: 720px) {
    .cc-main { grid-template-columns: 1fr; }
    .cc-topbar { gap: 10px; }
    .cc-nav { margin-left: 0; width: 100%; }
}
