* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    min-height: 100vh;
    color: #222;
}

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

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.95);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.logo { font-size: 22px; }
.title { font-weight: 600; font-size: 16px; }

.status { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #c33; box-shadow: 0 0 6px #c33;
}
.dot.connected { background: #2c2; box-shadow: 0 0 6px #2c2; }
.dot.connecting { background: #fa0; box-shadow: 0 0 6px #fa0; }

.icon-btn {
    border: none; background: #eee; cursor: pointer;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 16px;
}
.icon-btn:hover { background: #ddd; }

.panel {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.panel.hidden { display: none; }

h2, h3 { margin: 0 0 12px; }
.hint {
    background: #fff8e1;
    border-left: 3px solid #fa0;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 4px;
    margin: 0 0 12px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
}
label.row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label small { display: block; color: #888; font-weight: 400; margin-top: 3px; }
label code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; font-size: 11px; }

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 4px;
}
input:focus { outline: none; border-color: #2a5298; }

.btn-row { display: flex; gap: 8px; margin-top: 8px; }

.btn {
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s, opacity .2s;
}
.btn:hover:not(:disabled) { opacity: 0.9; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary { background: #2a5298; color: #fff; flex: 1; }
.btn.danger { background: #c33; color: #fff; flex: 1; }
.btn.call { background: #2c9; color: #fff; flex: 2; }
.btn.hangup { background: #c33; color: #fff; flex: 2; }
.btn.back { background: #eee; flex: 1; }
.btn.small { background: #eee; padding: 8px 10px; font-size: 12px; flex: 1; }

.display {
    background: #f5f7fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    text-align: center;
}
#numberInput {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 24px;
    text-align: center;
    font-weight: 500;
    letter-spacing: 1px;
}
.call-info { font-size: 13px; color: #666; min-height: 18px; }
.timer { font-size: 14px; color: #2a5298; font-weight: 600; min-height: 18px; }

.dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.key {
    background: #f0f4f8;
    border: 1px solid #d8dde3;
    border-radius: 50%;
    aspect-ratio: 1;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background .1s;
}
.key:hover { background: #e0e8f0; }
.key:active { background: #2a5298; color: #fff; }
.key small { font-size: 10px; color: #888; font-weight: 400; }
.key:active small { color: #fff; }

.actions { display: flex; gap: 8px; margin-bottom: 8px; }
.actions.secondary { flex-wrap: wrap; }

.log {
    max-height: 200px;
    overflow-y: auto;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 11px;
}
#log { white-space: pre-wrap; }
.log-line { padding: 2px 0; border-bottom: 1px solid #f0f0f0; }
.log-line.err { color: #c33; }
.log-line.ok { color: #2a8; }
.log-line.info { color: #555; }

@media (max-width: 480px) {
    .app { padding: 8px; }
    .key { font-size: 20px; }
}
