/* A'amer Services Dashboard — styled to echo the ARCHIBUS Web Central UI
   (navy sidebar, white work area) with the demo's emerald accent. */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1f2933;
    background: #f4f6f8;
}

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: #0b2545;
    color: #cdd9e8;
    flex-shrink: 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-mark { font-size: 20px; }
.brand-name { font-size: 18px; letter-spacing: 0.5px; }
.brand-ar { margin-left: 8px; font-weight: 600; opacity: 0.9; }

.nav { display: flex; flex-direction: column; padding: 10px 0; }
.nav-item {
    padding: 12px 20px;
    font-size: 14px;
    color: #cdd9e8;
    cursor: default;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); }
.nav-item.active {
    background: #16a34a;
    color: #fff;
    border-left-color: #bbf7d0;
    font-weight: 600;
}

/* Main */
.main { flex: 1; padding: 24px 32px; min-width: 0; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.page-title { display: flex; align-items: center; gap: 12px; }
.page-icon { font-size: 24px; }
.page-title h1 { margin: 0; font-size: 24px; color: #0b2545; }

.start-call {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
    transition: background 0.15s ease, transform 0.05s ease;
}
.start-call:hover { background: #15803d; }
.start-call:active { transform: translateY(1px); }
.start-call:disabled { opacity: 0.7; cursor: progress; }

.head-actions { display: flex; align-items: center; gap: 14px; }
.endpoint {
    font-size: 12px;
    color: #52606d;
    background: #eef1f5;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Call result panel */
.call-result {
    margin: 16px 0 0;
    background: #fff;
    border: 1px solid #d8dee6;
    border-left: 4px solid #94a3b8;
    border-radius: 8px;
    padding: 14px 18px;
}
.call-result.ok { border-left-color: #16a34a; }
.call-result.fail { border-left-color: #dc2626; }
.call-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.call-result-body {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 6px 14px;
    margin: 0;
    font-size: 14px;
}
.call-result-body dt { color: #52606d; font-weight: 600; }
.call-result-body dd { margin: 0; color: #1f2933; }
.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 13px;
}
.start-call .dot, .btn-primary .dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #d8dee6;
    margin-bottom: 0;
}
.tab {
    padding: 10px 18px;
    font-size: 14px;
    color: #52606d;
    background: #eef1f5;
    border: 1px solid #d8dee6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}
.tab.active {
    background: #fff;
    color: #0b2545;
    font-weight: 600;
    border-top: 3px solid #f59e0b;
}

/* Panel + table */
.panel {
    background: #fff;
    border: 1px solid #d8dee6;
    border-top: none;
    padding: 16px;
}
.panel-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #52606d;
    padding: 4px 4px 12px;
}
.panel-meta .count { color: #16a34a; font-weight: 600; }

.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eceff3;
    white-space: nowrap;
}
.grid thead th {
    background: #f7f9fb;
    color: #3e4c59;
    font-weight: 600;
    border-bottom: 2px solid #d8dee6;
}
.grid tbody tr:hover { background: #f9fbfd; }
.grid .num { text-align: right; }
.status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 600;
}

/* Nav: Workplace Services submenu + Call AI */
.nav-group { display: flex; flex-direction: column; }
.nav-item { cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.nav-item .caret { font-size: 10px; transition: transform 0.15s ease; opacity: 0.7; }
.nav-item.open .caret { transform: rotate(90deg); }
.nav-sub { background: rgba(0, 0, 0, 0.18); }
.nav-subitem {
    display: block;
    padding: 11px 20px 11px 34px;
    font-size: 13px;
    color: #cdd9e8;
    cursor: pointer;
}
.nav-subitem:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-ai {
    margin-top: 4px;
    color: #bbf7d0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-ai:hover { background: rgba(22, 163, 74, 0.25); color: #fff; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 37, 69, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    z-index: 50;
}
/* A class `display:flex` overrides the bare [hidden] attribute, so hide explicitly. */
.modal-overlay[hidden] { display: none; }
.modal {
    background: #fff;
    width: 100%;
    max-width: 640px;
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalIn 0.14s ease;
}
@keyframes modalIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #0b2545;
    color: #fff;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
    background: none; border: none; color: #cdd9e8;
    font-size: 24px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 20px; }
.modal-intro { margin: 0 0 16px; font-size: 14px; color: #52606d; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #eceff3;
    background: #f9fbfd;
}

/* Form fields */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: #3e4c59; margin-bottom: 5px; }
.field-label em { color: #dc2626; font-style: normal; }
.field-input {
    width: 100%;
    padding: 9px 11px;
    font-size: 14px;
    border: 1px solid #cbd2da;
    border-radius: 6px;
    background: #fff;
    color: #1f2933;
}
.field-input:focus { outline: none; border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }
.field-section {
    font-size: 13px; font-weight: 700; color: #0b2545;
    margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #eceff3;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* Buttons */
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    background: #16a34a; color: #fff; border: none;
    border-radius: 7px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #15803d; }
.btn-primary:disabled { opacity: 0.7; cursor: progress; }
.btn-secondary {
    background: #fff; color: #3e4c59; border: 1px solid #cbd2da;
    border-radius: 7px; padding: 10px 18px; font-size: 14px; cursor: pointer;
}
.btn-secondary:hover { background: #f1f4f8; }

.modal-msg { margin: 14px 0 0; font-size: 14px; min-height: 18px; }
.modal-msg.ok { color: #166534; font-weight: 600; }
.modal-msg.err { color: #dc2626; font-weight: 600; }

/* Call AI conversation */
.chat-log {
    min-height: 220px;
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 2px;
}
.chat-bubble {
    max-width: 80%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-bubble.bot {
    align-self: flex-start;
    background: #eef1f5;
    color: #1f2933;
    border-bottom-left-radius: 4px;
}
.chat-bubble.user {
    align-self: flex-end;
    background: #16a34a;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble.typing { color: #8a96a3; letter-spacing: 2px; }

.ai-foot { gap: 8px; }
.chat-input { flex: 1; }

/* Voice call status */
.call-status {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    font-weight: 600;
    color: #3e4c59;
    margin-bottom: 8px;
}
.mic-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}
.mic-dot.live {
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
    animation: pulse 1.5s infinite;
}
.mic-dot.err { background: #dc2626; }

.created-banner {
    margin-top: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
    font-size: 14px;
}
