/* === Pillars Brewery Agent Dashboard === */
/* Brand: Pillars Brewery, Walthamstow. Identity by Thunderclap. */
/* Colours drawn from pillarsbrewery.com. Serif + sans-serif pairing. */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Pillars brand palette */
    --pillars-orange: #F15A29;
    --pillars-orange-light: rgba(241, 90, 41, 0.10);
    --pillars-orange-hover: #d94e22;
    --pillars-cream: #FCEEE0;
    --pillars-cream-light: #FBF9F7;
    --pillars-dark: #1a1a1a;
    --pillars-dark-green: #262D26;
    --pillars-tan: #BEB8AE;
    --pillars-tan-light: #E3DCD1;

    /* Functional colours */
    --bg-primary: var(--pillars-cream-light);
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: var(--pillars-cream);
    --border: #e5ddd2;
    --border-light: #f0ebe4;
    --text-primary: var(--pillars-dark);
    --text-secondary: #5c564e;
    --text-muted: #8c857b;

    /* Status colours */
    --green: #2d8a4e;
    --green-bg: rgba(45, 138, 78, 0.10);
    --amber: #c27a1a;
    --amber-bg: rgba(194, 122, 26, 0.10);
    --red: #c43e2a;
    --red-bg: rgba(196, 62, 42, 0.10);
    --blue: #2c6fba;
    --blue-bg: rgba(44, 111, 186, 0.10);
    --grey: #8c857b;

    /* Typography */
    --font-heading: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* === Top Bar === */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 58px;
    background: var(--pillars-dark);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 24px;
    width: auto;
    display: block;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 400;
    color: var(--pillars-cream);
    letter-spacing: 0.02em;
}

.logo .logo-divider {
    width: 1px;
    height: 20px;
    background: rgba(252, 238, 224, 0.25);
    margin: 0 2px;
}

.logo .logo-subtitle {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    color: var(--pillars-tan);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    gap: 2px;
}

.nav-link {
    color: var(--pillars-tan);
    text-decoration: none;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    letter-spacing: 0.01em;
}

.nav-link:hover {
    color: var(--pillars-cream);
    background: rgba(252, 238, 224, 0.08);
}

.nav-link.active {
    color: var(--pillars-cream);
    background: var(--pillars-orange);
    font-weight: 600;
}

/* === Main Content === */
#app-content {
    padding: 24px 28px;
    max-width: 1600px;
    margin: 0 auto;
}

/* === Page headings === */
#app-content h2 {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 24px;
    color: var(--pillars-dark);
}

/* === Summary Cards === */
.summary-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
}

.summary-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.summary-card .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.summary-card .value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
}

.summary-card .value.green { color: var(--green); }
.summary-card .value.amber { color: var(--amber); }
.summary-card .value.red { color: var(--red); }

/* === Filter Bar === */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font);
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--pillars-orange);
    box-shadow: 0 0 0 2px var(--pillars-orange-light);
}

.filter-bar label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === Agent Table === */
.agent-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.agent-table th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--pillars-cream);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.agent-table th:hover {
    color: var(--text-primary);
}

.agent-table th .sort-arrow {
    margin-left: 4px;
    font-size: 10px;
}

.agent-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    white-space: nowrap;
}

.agent-table tr:last-child td {
    border-bottom: none;
}

.agent-table tr:hover td {
    background: var(--pillars-cream);
    cursor: pointer;
}

.agent-table .agent-name {
    font-weight: 600;
    color: var(--pillars-orange);
}

.agent-table .agent-id {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* === Status & Tier Badges === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-active .status-dot,
.status-success .status-dot { background: var(--green); }
.status-active,
.status-success { background: var(--green-bg); color: var(--green); }

.status-paused .status-dot,
.status-partial .status-dot,
.status-in-development .status-dot { background: var(--amber); }
.status-paused,
.status-partial,
.status-in-development { background: var(--amber-bg); color: var(--amber); }

.status-failed .status-dot,
.status-deprecated .status-dot { background: var(--red); }
.status-failed { background: var(--red-bg); color: var(--red); }
.status-deprecated { background: rgba(140, 133, 123, 0.10); color: var(--grey); }
.status-deprecated .status-dot { background: var(--grey); }

.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.tier-1 { background: var(--blue-bg); color: var(--blue); }
.tier-2 { background: var(--amber-bg); color: var(--amber); }
.tier-3 { background: var(--red-bg); color: var(--red); }

/* === Agent Detail Page === */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.detail-header h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 400;
    margin-bottom: 4px;
}

.detail-header .agent-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-header .badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 12px;
    display: inline-block;
    font-weight: 500;
}

.back-link:hover {
    color: var(--pillars-orange);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.detail-card h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--pillars-orange-light);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-row .info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.info-value a {
    color: var(--pillars-orange);
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

.overdue {
    color: var(--red) !important;
    font-weight: 700 !important;
}

/* === Charts === */
.chart-container {
    position: relative;
    height: 250px;
    margin-top: 8px;
}

/* === Run History Table (inside detail) === */
.run-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.run-table th {
    text-align: left;
    padding: 9px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--pillars-cream-light);
}

.run-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-light);
}

.run-table tr:last-child td {
    border-bottom: none;
}

.run-table .run-summary {
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* === Cost Dashboard === */
.cost-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

/* === Knowledge Base === */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--pillars-orange);
    box-shadow: 0 0 0 2px var(--pillars-orange-light);
}

.search-bar button {
    background: var(--pillars-orange);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.search-bar button:hover {
    background: var(--pillars-orange-hover);
}

.search-result {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.search-result:hover {
    border-color: var(--pillars-orange);
    box-shadow: 0 2px 8px rgba(241, 90, 41, 0.08);
}

.search-result h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--pillars-dark);
}

.search-result .meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.search-result .snippet {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.search-result .snippet mark {
    background: var(--pillars-orange-light);
    color: var(--pillars-orange);
    padding: 1px 3px;
    border-radius: 2px;
}

.readme-viewer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 36px;
    line-height: 1.7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.readme-viewer h1, .readme-viewer h2, .readme-viewer h3 {
    font-family: var(--font-heading);
    font-weight: 400;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--pillars-dark);
}

.readme-viewer table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.readme-viewer th, .readme-viewer td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    font-size: 13px;
}

.readme-viewer th {
    background: var(--pillars-cream);
}

.readme-viewer code {
    font-family: var(--mono);
    background: var(--pillars-cream);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.readme-viewer pre {
    background: var(--pillars-dark);
    color: var(--pillars-cream);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.readme-viewer pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* === Alerts Page === */
.alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s;
}

.alert-item:hover {
    border-color: var(--pillars-tan);
}

.alert-severity {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-severity.high { background: var(--red); }
.alert-severity.medium { background: var(--amber); }
.alert-severity.low { background: var(--grey); }

.alert-info {
    flex: 1;
}

.alert-info .alert-agent {
    font-weight: 600;
    font-size: 13px;
}

.alert-info .alert-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.alert-type-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 4px;
    background: var(--pillars-cream);
    color: var(--text-muted);
}

/* === Login Screen === */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--pillars-dark);
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 48px 40px;
    width: 380px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-logo {
    height: 28px;
    width: auto;
    margin-bottom: 24px;
    filter: invert(1);
}

.login-card h2 {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 22px;
    color: var(--pillars-dark);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-card input[type="password"] {
    background: var(--pillars-cream-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font);
    text-align: center;
}

.login-card input[type="password"]:focus {
    outline: none;
    border-color: var(--pillars-orange);
    box-shadow: 0 0 0 2px var(--pillars-orange-light);
}

.login-card button[type="submit"] {
    background: var(--pillars-orange);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font);
}

.login-card button[type="submit"]:hover {
    background: var(--pillars-orange-hover);
}

.login-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
    padding: 4px 0;
}

/* === Logout Button in Nav === */
.nav-logout {
    margin-left: 12px;
    border-left: 1px solid rgba(252, 238, 224, 0.15);
    padding-left: 16px !important;
    color: var(--pillars-tan) !important;
    opacity: 0.7;
}

.nav-logout:hover {
    opacity: 1;
    color: var(--pillars-cream) !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    font-size: 14px;
}

/* === Utility === */
.text-mono {
    font-family: var(--mono);
    font-size: 12px;
}

.text-muted {
    color: var(--text-muted);
}

.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }

.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* === Register Agent Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.6);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    overflow-y: auto;
}

.modal-card {
    background: var(--bg-card);
    border-radius: 12px;
    width: 680px;
    max-width: 95vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    margin-bottom: 40px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 0;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 400;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}

.modal-close:hover {
    background: var(--pillars-cream);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 28px 28px;
}

.form-section {
    margin-bottom: 20px;
}

.form-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--pillars-orange-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--pillars-orange);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--pillars-cream-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--pillars-orange);
    box-shadow: 0 0 0 2px var(--pillars-orange-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 28px 24px;
}

.btn-primary {
    background: var(--pillars-orange);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font);
}

.btn-primary:hover {
    background: var(--pillars-orange-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--pillars-cream);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font);
}

.btn-secondary:hover {
    background: var(--pillars-cream-light);
    border-color: var(--pillars-tan);
}

.form-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 0;
}

.form-success {
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 0;
}
