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

:root {
    --color-primary: #2b4656;
    --color-primary-hover: #98CA43;
    --color-success: #98CA43;
    --color-danger: #b84040;
    --color-warning: #c9745e;
    --color-bg: #fdfdfd;
    --color-surface: #ffffff;
    --color-text: #111111;
    --color-subtitle: #525252;
    --color-muted: #6b7280;
    --color-border: #d1d5db;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --shadow-focus: 0 0 0 3px rgba(43,70,86,0.2);
    --transition: all 0.2s ease;
}

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

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

/* ---- Login page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}

.login-page-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2.5rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.8);
    text-align: center;
}

.login-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--color-text);
}

.login-subtitle {
    color: var(--color-subtitle);
    margin-bottom: 2.5rem;
    font-size: 1rem;
}

.login-btn--microsoft {
    display: inline-block;
    padding: 0.875rem 2.25rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.login-btn--microsoft:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.login-disclaimer {
    margin-top: 2.5rem;
    font-size: 0.75rem;
    color: var(--color-muted);
    line-height: 1.4;
}

/* ---- Dashboard layout ---- */
.dash-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg);
}

.dash-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
}

.dash-sidebar__header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.dash-sidebar__logo {
    max-width: 120px;
    height: auto;
}

.dash-sidebar__app-name {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 0.5rem;
}

.dash-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.dash-nav__section {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

.dash-nav__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.dash-nav__link:hover,
.dash-nav__link--active {
    background: rgba(43,70,86,0.08);
    color: var(--color-primary);
    font-weight: 500;
}

.dash-nav__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.6;
}

.dash-nav__link:hover .dash-nav__icon,
.dash-nav__link--active .dash-nav__icon {
    opacity: 1;
}

.dash-sidebar__footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
}

.dash-sidebar__user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-subtitle);
    margin-bottom: 0.75rem;
}

.dash-sidebar__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.dash-sidebar__user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

/* ---- Page header ---- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header__title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.page-header__subtitle {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

/* ---- Cards ---- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.card__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    font-weight: 600;
}

.card__body {
    padding: 1.25rem;
}

/* ---- Screen-pop call card ---- */
.pop-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 260px - 4rem);
    min-height: 200px;
}

.pop-idle__icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.2;
}

.pop-idle__text {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.pop-card {
    max-width: 480px;
    display: none;
}

.pop-card.active {
    display: block;
}

.pop-banner {
    padding: 1.25rem 1.5rem;
    color: #fff;
}

.pop-banner.ringing {
    background: var(--color-primary);
    animation: pulse-bg 1.5s ease-in-out infinite;
}

.pop-banner.active {
    background: var(--color-success);
}

.pop-banner.released {
    background: var(--color-muted);
}

@keyframes pulse-bg { 0%, 100% { opacity: 1; } 50% { opacity: .85; } }

.pop-banner__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
}

.pop-banner__number {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.15rem;
}

.pop-banner__name {
    font-size: 0.9rem;
    opacity: 0.9;
}

.pop-banner__timer {
    font-size: 0.85rem;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.pop-form {
    padding: 1.25rem 1.5rem;
}

/* ---- Form fields ---- */
.field {
    margin-bottom: 1rem;
}

.field__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-subtitle);
    margin-bottom: 0.3rem;
}

.field__input,
.field__select,
.field__textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: var(--transition);
}

.field__textarea {
    resize: vertical;
    min-height: 60px;
}

.field__input:focus,
.field__select:focus,
.field__textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--color-border);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-subtitle);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ---- Action row ---- */
.actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

.actions__msg {
    color: var(--color-success);
    font-size: 0.85rem;
    margin-right: auto;
}

/* ---- Status dot ---- */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot--connected { background: var(--color-success); }
.status-dot--disconnected { background: var(--color-danger); }
.status-dot--connecting { background: var(--color-warning); }

/* ---- Logout button ---- */
.btn-logout {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--color-muted);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-logout:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .dash-sidebar {
        left: -260px;
    }

    .dash-main {
        margin-left: 0;
        padding: 1.25rem;
    }

    .login-page-wrapper {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
}
