/* ============================================================
   layout.css — Top-level layout: body, .layout, .content, .main
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-gradient), var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.layout {
    display: flex;
    min-height: 100vh;
}
.layout.sidebar-collapsed .sidebar { display: none; }

.content {
    flex: 1;
    min-width: 0;
    height: 100vh;
    max-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
}

.main {
    max-width: 980px;
    width: 100%;
    padding: 0 1.5rem 2.2rem;
    display: grid;
    grid-auto-rows: 1fr;
    overflow: hidden;
    margin: 0 auto;
}
.main:has(.community-view:not(.hidden)) {
    padding-bottom: 0;
}
.main:has(.agent-shell.chat-active) {
    display: flex;
    flex-direction: column;
    grid-auto-rows: initial;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Shared card */
.card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    padding: 0.86rem;
}
.card h2 { font-size: 0.96rem; margin-bottom: 0.44rem; }
.card p  { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }

/* Utility */
.row   { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
/* !important ensures .hidden beats any display value from other classes or inline styles */
.hidden { display: none !important; }
.ok   { color: var(--ok); }

/* Secondary sections */
.secondary-section { display: none; }
.secondary-section.show {
    display: block;
    width: min(860px, 100%);
    margin-left: auto;
    margin-right: auto;
}

/* Lists */
.list { list-style: none; padding-left: 0; margin-top: 0.52rem; }
.list li {
    border-bottom: 1px solid var(--line);
    padding: 0.44rem 0;
    font-size: 0.84rem;
    color: #b4c1dc;
}
.list li:last-child { border-bottom: none; }

/* Pill badge */
.pill {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.11rem 0.44rem;
    font-size: 0.72rem;
    color: var(--pill-color);
    background: var(--pill-bg);
}

/* Ticket item */
.ticket-item {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0.56rem;
    margin-top: 0.5rem;
    background: var(--ticket-bg);
}
.ticket-item h3  { font-size: 0.84rem; margin-bottom: 0.2rem; }
.ticket-meta     { font-size: 0.76rem; color: var(--muted); }

/* Status line */
.status { margin-top: 0.44rem; min-height: 0; font-size: 0.82rem; color: var(--danger); }

/* Buttons */
.btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 9px;
    padding: 0.5rem 0.66rem;
    text-decoration: none;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn:hover { color: var(--text); background: var(--btn-hover-bg); }
.btn-primary {
    color: #e7eeff;
    border-color: var(--btn-pri-border);
    background: linear-gradient(180deg, #3454bb 0%, #29408e 100%);
}
.btn-primary:hover {
    background: linear-gradient(180deg, #3d5fd0 0%, #2d479f 100%);
}

/* Form inputs */
.text-input, .text-area, .select-input {
    width: 100%;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: 9px;
    padding: 0.56rem 0.64rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
}
.text-input:focus { outline: none; }
.text-area { min-height: 96px; resize: vertical; }

@media (max-width: 1000px) {
    .main { grid-template-columns: 1fr; }
    .content { height: 100svh; max-height: 100svh; }
}
