/* NicePhone mobile / PWA shell — compact app bar, safe areas, tab bar */

.np-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none !important;
  line-height: 1;
}
.np-logo-mark {
  width: 26px;
  height: auto;
  flex-shrink: 0;
  display: block;
}
.np-logo-word {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.np-logo--dark .np-logo-word { color: #fff; }
.np-logo--dark .np-logo-word span { color: #3b82f6; }
.np-logo--light .np-logo-word { color: #0f172a; }
.np-logo--light .np-logo-word span { color: #2563eb; }
.np-logo-img {
  height: 28px;
  width: auto;
  max-width: 168px;
  display: block;
}
.navbar.np-nav .np-logo {
  margin-right: 8px;
  padding-top: 0;
  padding-bottom: 0;
}

:root {
  --np-safe-t: env(safe-area-inset-top, 0px);
  --np-safe-b: env(safe-area-inset-bottom, 0px);
  --np-bar-h: 52px;
  --np-tab-h: 56px;
  --np-brand: #10b981;
  --np-ink: #0f172a;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  -webkit-tap-highlight-color: transparent;
}

/* Incoming call — always above chrome, never trapped in the hamburger */
.incoming-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff7ed;
  color: #9a3412;
  padding: 10px 14px;
  border-bottom: 1px solid #fdba74;
}

.incoming-bar .incoming-text {
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}

.incoming-bar .incoming-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.incoming-bar .btn {
  padding: 6px 14px;
  font-weight: 600;
}

@media (max-width: 991.98px) {
  html,
  body {
    background: #f8fafc;
  }

  body {
    padding-bottom: calc(var(--np-tab-h) + var(--np-safe-b) + 8px);
  }

  input:not(#dial), select, textarea {
    font-size: 16px;
  }

  .navbar.np-nav {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--np-bar-h);
    margin-bottom: 0 !important;
    padding-top: var(--np-safe-t);
    padding-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .navbar.np-nav .container-fluid {
    min-height: var(--np-bar-h);
    padding-left: 12px;
    padding-right: 10px;
  }

  .navbar.np-nav .navbar-brand,
  .navbar.np-nav .np-logo {
    font-size: 17px !important;
    letter-spacing: -0.03em;
  }
  .navbar.np-nav .np-logo-mark { width: 22px; }
  .navbar.np-nav .np-logo-word { font-size: 16px; }

  .np-nav-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .np-nav-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 6px;
  }

  .np-nav-tools .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 8px;
  }

  .navbar.np-nav .navbar-toggler {
    padding: 6px 8px;
    border: 0;
    box-shadow: none;
  }

  .navbar.np-nav .navbar-collapse {
    width: 100%;
    margin-top: 4px;
    padding: 8px 4px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .navbar.np-nav .nav-link {
    padding: 10px 12px !important;
    font-size: 15px !important;
  }

  .np-nav-user {
    width: 100%;
    padding: 10px 4px 0;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-between !important;
  }

  .np-nav-legal {
    width: 100%;
    padding: 10px 12px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.38);
  }

  .incoming-bar,
  .wallet-warn-bar {
    position: sticky;
    top: calc(var(--np-bar-h) + var(--np-safe-t));
    z-index: 1025;
    margin: 0;
    border-radius: 0;
  }

  .footer-wrapper {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #e2e8f0;
    padding-bottom: var(--np-safe-b);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  }

  .footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    min-height: var(--np-tab-h);
    padding: 4px 4px 2px;
  }

  .footer-nav a {
    flex: 1;
    max-width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    min-height: 48px;
    border-radius: 12px;
    position: relative;
  }

  .footer-nav a i {
    font-size: 20px;
    line-height: 1;
  }

  .footer-nav a.active {
    color: var(--np-brand);
    font-weight: 700;
  }

  .footer-nav a.active i {
    color: var(--np-brand);
  }

  .footer-legal {
    display: none;
  }

  .badge-dot {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    min-width: 16px;
    padding: 0 5px;
    font-size: 10px;
    line-height: 16px;
    font-weight: 700;
  }

  /* Dialer — fill the screen like a phone app */
  #page-root[data-page="home"] .crm-container {
    padding: 0;
    max-width: none;
  }

  #page-root[data-page="home"] .call-panel {
    border-radius: 0;
    margin: 0;
    min-height: calc(100dvh - var(--np-bar-h) - var(--np-tab-h) - var(--np-safe-t) - var(--np-safe-b));
    display: flex;
    flex-direction: column;
    padding: 18px 20px 20px;
    box-shadow: none;
  }

  #page-root[data-page="home"] .dialer-input {
    margin-bottom: 8px;
  }

  #page-root[data-page="home"] .call-panel input {
    background: transparent;
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    padding: 8px 8px;
    box-shadow: none;
  }

  #page-root[data-page="home"] .call-panel input::placeholder {
    color: rgba(255, 255, 255, 0.45);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0;
  }

  #page-root[data-page="home"] .call-panel .btn-clear {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
  }

  #page-root[data-page="home"] .status-display {
    margin: 4px 0 8px;
    font-size: 13px;
    opacity: 0.8;
  }

  #page-root[data-page="home"] #keypad {
    display: grid !important;
    flex: 1;
    width: 100%;
    max-width: 300px;
    margin: 8px auto 0;
    gap: 10px;
    align-content: center;
  }

  #page-root[data-page="home"] #keypad button {
    min-height: 58px;
    padding: 0;
    font-size: 24px;
    font-weight: 500;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    touch-action: manipulation;
  }

  #page-root[data-page="home"] #keypad button:active {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(0.96);
  }

  #page-root[data-page="home"] .call-controls {
    margin: 16px 0 4px;
    gap: 20px;
  }

  #page-root[data-page="home"] .btn-call-control {
    width: 68px;
    height: 68px;
    font-size: 26px;
  }

  #page-root[data-page="home"] .main-content {
    display: none;
  }

  #crmSheet {
    padding-bottom: var(--np-safe-b);
  }

  /* List pages */
  #page-root[data-page="contacts"] .container,
  #page-root[data-page="logs"] .container,
  #page-root[data-page="voicemail"] .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  #page-root[data-page="contacts"] .add-box {
    border-radius: 14px;
    border-color: #e2e8f0;
  }

  #page-root[data-page="logs"] h3,
  #page-root[data-page="voicemail"] h3,
  #page-root[data-page="contacts"] h5 {
    font-size: 20px;
    font-weight: 700;
  }

  #page-root[data-page="logs"] .row.g-2 > .col-auto {
    flex: 1 1 42%;
  }

  .help-wrap,
  .obd-console {
    padding-bottom: 8px;
  }
}

@media (min-width: 992px) {
  .footer-wrapper,
  .footer-spacer,
  .np-nav-legal {
    display: none !important;
  }

  .np-nav-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    margin-right: 8px;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .navbar.np-nav {
    padding-top: var(--np-safe-t);
  }

  #page-root[data-page="home"] #keypad {
    display: grid !important;
  }
}

@media (max-width: 380px) {
  #page-root[data-page="home"] #keypad button {
    min-height: 52px;
    font-size: 22px;
  }

  #page-root[data-page="home"] .btn-call-control {
    width: 60px;
    height: 60px;
  }

  .footer-nav a {
    font-size: 9px;
  }
}
