* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.login-card h1 {
    margin: 0 0 4px;
    font-size: 22px;
}

.subtitle {
    margin: 0 0 24px;
    color: #94a3b8;
    font-size: 14px;
}

.login-card label {
    display: block;
    font-size: 13px;
    margin: 14px 0 6px;
    color: #94a3b8;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 16px;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 13px;
    border-radius: 10px;
    border: none;
    background: #22c55e;
    color: #06210f;
    font-weight: 600;
    font-size: 16px;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.alert-error {
    background: #450a0a;
    color: #fecaca;
}

/* ---------- App shell ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #1e293b;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .ext {
    color: #94a3b8;
    font-size: 12px;
    margin-left: 8px;
}

.reg-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #334155;
    color: #cbd5e1;
}

.reg-status.ok { background: #14532d; color: #86efac; }
.reg-status.err { background: #450a0a; color: #fecaca; }

.logout-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
}

.app-main {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
}

.screen.hidden { display: none; }

/* ---------- Dial screen ---------- */
.video-preview {
    width: 100%;
    aspect-ratio: 3/4;
    background: #1e293b;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#dialInput {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    margin-bottom: 12px;
}

.btn {
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 14px;
    width: 100%;
}

.btn-call { background: #22c55e; color: #06210f; }
.btn-reject { background: #ef4444; color: #fff; }
.btn-answer { background: #22c55e; color: #06210f; }

/* ---------- Incoming call ---------- */
.incoming-box {
    text-align: center;
    padding: 60px 16px;
}

.incoming-label {
    color: #94a3b8;
    margin-bottom: 4px;
}

.incoming-from {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
}

.incoming-actions {
    display: flex;
    gap: 12px;
}

/* ---------- Call screen ---------- */
#callScreen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 50;
    display: flex;
}

#callScreen.hidden { display: none; }

.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 110px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #334155;
}

.call-info {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0,0,0,.5);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
}

.call-controls {
    position: absolute;
    bottom: 32px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn-round {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    font-size: 12px;
}

.btn-hangup { background: #ef4444; }

@media (min-width: 600px) {
    .app-main { padding-top: 40px; }
}
