:root {
  --navy: #071b31;
  --navy-2: #0b2947;
  --blue: #2578e8;
  --cyan: #20c7c9;
  --green: #10a66a;
  --red: #d94b55;
  --ink: #102038;
  --muted: #65758b;
  --paper: #ffffff;
  --canvas: #f1f5f9;
  --line: #d8e2ec;
  --shadow: 0 18px 50px rgba(7, 27, 49, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: .72rem; font-weight: 900; letter-spacing: .16em; }

.login-shell {
  min-height: 100vh; display: grid; place-content: center; gap: 20px; padding: 28px;
  color: white; background: radial-gradient(circle at 50% 0%, #123f68 0, var(--navy) 48%);
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.login-brand strong { display: block; font-size: 1.55rem; }
.login-brand small { display: block; color: #9cc5f1; letter-spacing: .18em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid #4e83b2; border-radius: 18px; background: #0c2741; font-size: 2rem; }
.brand-mark i, .mini-logo i { position: absolute; right: 5px; bottom: 3px; color: var(--cyan); font-style: normal; font-size: .72rem; }
.login-card { width: min(470px, calc(100vw - 40px)); padding: 36px; border: 1px solid #315b83; border-radius: 24px; background: rgba(12, 40, 67, .94); box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 2.2rem; }
label { display: grid; gap: 7px; margin-top: 20px; font-size: .84rem; font-weight: 800; }
input { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: var(--paper); color: var(--ink); }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 120, 232, .15); }
.login-card input { border-color: #315b83; background: #061a2e; color: white; }
.primary, .secondary, .danger { border-radius: 12px; font-weight: 900; }
.primary { width: 100%; min-height: 52px; margin-top: 28px; border: 0; color: white; background: linear-gradient(90deg, #206ed4, #3294f5); }
.secondary { padding: 10px 14px; border: 1px solid #bdd2e7; color: #1264ca; background: white; }
.danger { padding: 10px 16px; border: 1px solid #efb8bd; color: #b62d38; background: #fff3f4; }
.error { min-height: 20px; color: #ffb1b7; font-size: .85rem; }
.login-shell footer { text-align: center; color: #9cc5f1; font-size: .75rem; }

.app-shell { min-height: 100vh; padding-bottom: 86px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 10px clamp(18px, 4vw, 56px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.app-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.app-brand strong, .app-brand small { display: block; }
.app-brand small { color: var(--muted); font-size: .72rem; }
.mini-logo { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--navy); font-size: 1.35rem; }
.account { position: relative; display: flex; align-items: center; gap: 10px; }
.presence { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 13px; border: 1px solid #9bdabb; border-radius: 10px; color: #087848; background: #effbf5; }
.presence > span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.presence.dnd { border-color: #f1c26d; color: #9b6100; background: #fff8e9; }
.presence.dnd > span { background: #e59a12; }
.presence.offline { border-color: #c8d0da; color: #59677a; background: #f5f7f9; }
.presence.offline > span { background: #7a8797; }
.presence-menu { position: absolute; z-index: 30; top: 50px; left: 0; min-width: 170px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.presence-menu button { width: 100%; padding: 10px; border: 0; border-radius: 8px; text-align: left; background: transparent; }
.presence-menu button:hover { background: var(--canvas); }
.profile-button { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; text-align: left; background: transparent; color: var(--ink); }
.profile-button b, .profile-button small { display: block; }
.profile-button small { color: var(--muted); font-size: .72rem; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 13px; color: white; background: var(--navy-2); font-weight: 900; background-size: cover; background-position: center; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.view { display: none; min-height: calc(100vh - 162px); padding: 40px 0; }
.view.active { display: block; }
.hero { text-align: center; }
.hero h1, .section-heading h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.dialer-card { width: min(440px, 100%); margin: 28px auto 0; padding: 22px; border: 1px solid var(--line); border-radius: 26px; background: white; box-shadow: var(--shadow); }
.number-display { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.number-display input { border: 0; border-radius: 0; text-align: center; font-size: 1.35rem; font-weight: 800; }
.number-display button { width: 58px; height: 52px; border: 0; color: var(--muted); background: white; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.keypad button { min-height: 62px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #f8fafc; font-size: 1.35rem; font-weight: 800; }
.keypad button:active { transform: scale(.97); background: #eaf2fc; }
.keypad small { display: block; color: var(--muted); font-size: .55rem; letter-spacing: .08em; }
.call-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 56px; border: 0; border-radius: 18px; color: white; background: var(--green); font-size: 1rem; font-weight: 900; }
.call-button:disabled { cursor: not-allowed; background: #9aa7b7; }
.call-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #f8fafc; }
.call-panel small, .call-panel strong { display: block; }
.call-panel small { color: var(--muted); }
.call-panel strong { margin-top: 3px; font-size: 1.05rem; }
.call-actions { display: flex; gap: 8px; }
.call-actions button { min-height: 40px; padding: 0 14px; border-radius: 11px; font-weight: 900; }
.call-actions .answer { border: 1px solid #83d5ad; color: #087848; background: #effbf5; }
.call-actions .hangup { border: 1px solid #efb8bd; color: #b62d38; background: #fff3f4; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: white; font-size: 1.35rem; }
.search input { border: 0; box-shadow: none; }
.list-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: 0 10px 30px rgba(7, 27, 49, .06); }
.list-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px; min-height: 76px; padding: 12px 18px; border-bottom: 1px solid #edf1f5; }
.list-row:last-child { border-bottom: 0; }
.list-row strong, .list-row small { display: block; }
.list-row small { color: var(--muted); }
.list-avatar { display: grid; place-items: center; width: 46px; height: 46px; overflow: hidden; border-radius: 14px; color: white; background: var(--navy-2); background-size: cover; background-position: center; font-weight: 900; }
.row-call { width: 42px; height: 42px; border: 1px solid #9bdabb; border-radius: 12px; color: #087848; background: #effbf5; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(3, 1fr); min-height: 72px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.bottom-nav a { display: grid; place-content: center; gap: 3px; color: var(--muted); text-align: center; text-decoration: none; font-size: .75rem; font-weight: 800; }
.bottom-nav a span { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--blue); }

.admin-shell main { width: min(1240px, calc(100% - 32px)); }
.admin-view { display: none; min-height: calc(100vh - 162px); padding: 40px 0; }
.admin-view.active { display: block; }
.admin-intro { max-width: 760px; margin: -8px 0 24px; line-height: 1.55; }
.admin-grid, .provisioning-list, .audit-list { display: grid; gap: 12px; }
.admin-user-card, .provision-row, .audit-row {
  display: grid; align-items: center; gap: 16px; min-height: 76px; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--paper);
  box-shadow: 0 8px 24px rgba(7, 27, 49, .05);
}
.admin-user-card { grid-template-columns: 52px minmax(190px, 1fr) auto minmax(145px, auto); }
.provision-row { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; }
.audit-row { grid-template-columns: minmax(220px, 1fr) auto; }
.admin-user-identity strong, .admin-user-identity small,
.provision-row strong, .provision-row small,
.audit-row strong, .audit-row small { display: block; }
.admin-user-identity small, .provision-row small, .audit-row small {
  margin-top: 4px; color: var(--muted);
}
.access-badge {
  display: inline-flex; align-items: center; justify-content: center; min-height: 30px;
  padding: 0 10px; border: 1px solid #c8d0da; border-radius: 9px;
  color: #59677a; background: #f5f7f9; font-size: .75rem; font-weight: 900;
}
.access-badge.active { border-color: #9bdabb; color: #087848; background: #effbf5; }
.access-badge.pending { border-color: #f1c26d; color: #8b5906; background: #fff8e9; }
button:disabled { cursor: not-allowed; opacity: .58; }

dialog { width: min(500px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(7,27,49,.68); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
.dialog-title { display: flex; align-items: start; justify-content: space-between; }
.dialog-title h2 { margin: 0; }
.dialog-title button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: white; font-size: 1.45rem; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-top: 24px; }
.dialog-actions .primary { margin: 0; }
.message { min-height: 18px; color: var(--green); }

@media (max-width: 720px) {
  .app-brand span:last-child, .profile-button span:last-child { display: none; }
  .presence b { font-size: .78rem; }
  .topbar { padding: 10px 14px; }
  main { width: min(100% - 22px, 1180px); }
  .view { padding-top: 24px; }
  .login-card { padding: 26px; }
  .section-heading { align-items: center; }
  .admin-user-card { grid-template-columns: 52px 1fr; }
  .admin-user-card .access-badge, .admin-user-card button { grid-column: 2; justify-self: start; }
  .provision-row, .audit-row { grid-template-columns: 1fr; }
}
