* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

:root {
    --page-bg: #050814;
    --page-bg-soft: rgba(255, 255, 255, 0.02);
    --page-border: rgba(255, 255, 255, 0.08);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.62);
    --muted-2: rgba(255, 255, 255, 0.42);
    --glass-panel: linear-gradient(180deg, var(--surface-bg-top, rgba(255, 255, 255, 0.035)) 0%, var(--surface-bg-bottom, rgba(255, 255, 255, 0.015)) 100%);
    --glass-line: rgba(255, 255, 255, 0.08);
    --glass-line-strong: rgba(255, 255, 255, 0.14);
    --glass-fill: rgba(255, 255, 255, 0.04);
    --glass-fill-strong: rgba(255, 255, 255, 0.07);
    --glass-shadow: var(--surface-shadow, 0 30px 80px rgba(0, 0, 0, 0.45));
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(1100px 700px at 20% -10%, rgba(34, 197, 94, 0.10), transparent 55%),
        radial-gradient(900px 600px at 85% 8%, rgba(59, 130, 246, 0.10), transparent 55%),
        var(--page-bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: clip;
}

body.item-alert-modal-open {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
    overflow: hidden;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    overflow: visible;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: visible;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
}

.navbar-brand img {
    width: 32px;
    height: 32px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 30px;
    overflow: visible;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    overflow: visible;
}

.navbar-links > a {
    color: #9CA3AF;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.navbar-links > a:not(.discord-button) {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.navbar-links > a .nav-icon {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    opacity: 0.75;
    flex-shrink: 0;
}

.navbar-links > a:hover .nav-icon {
    opacity: 1;
}

.navbar-links > a:hover {
    color: #FFFFFF;
}

.navbar-links > a.active {
    color: #5B9FED;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    opacity: 0.8;
}

.discord-button {
    display: inline-flex;
    align-items: center;
    margin-left: 50px;
    gap: 0.45rem;
    padding: 1px 0;
    border-radius: 0;
    background: transparent;
    color: #9aa7bf;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    border: none;
    box-shadow: none;
    transition: color 0.2s ease, text-decoration-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.discord-button svg {
    width: 26px;
    height: 26px;
    display: block;
    fill: currentColor;
    opacity: 0.8;
    flex-shrink: 0;
    overflow: visible;
}

.discord-button:hover {
    color: #c9d6ee;
    text-decoration: underline;
    text-decoration-color: rgba(201, 214, 238, 0.6);
    transform: translateY(-1px);
}

.discord-button:hover svg {
    opacity: 1;
}

.discord-button:focus-visible {
    outline: 2px solid #6f93e8;
    outline-offset: 2px;
}

.discord-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-button:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.user-button::after {
    content: '\25BC';
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.user-dropdown.active .user-button::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2a2e3a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 0.5rem;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #9CA3AF;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dropdown-menu a:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-menu a:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
}

.dropdown-menu a .menu-icon {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    opacity: 0.8;
    flex-shrink: 0;
}

.dropdown-menu a:hover .menu-icon {
    opacity: 1;
}

.dropdown-menu a.logout {
    color: #EF4444;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-menu a.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 768px) {
    .dropdown-menu {
        border-radius: 6px;
        padding: 0.3rem;
    }

    .dropdown-menu a {
        padding: 0.6rem 0.8rem;
        border-radius: 6px;
    }

    .dropdown-menu a:first-child,
    .dropdown-menu a:last-child {
        border-radius: 6px;
    }
}

.item-alerts-page {
    max-width: 1480px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
    width: 100%;
    overflow-x: clip;
}

.hero {
    margin-bottom: 1.15rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.65rem, 2.4vw, 2.25rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

.hero p {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.97rem;
}

.hero-meta {
    margin-top: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.78rem;
    border-radius: 999px;
    border: 1px solid var(--glass-line-strong);
    background: var(--glass-fill);
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.meta-chip strong {
    color: #34d399;
}

.panel {
    border: 1px solid var(--surface-border, rgba(148, 163, 184, 0.16));
    border-radius: 22px;
    background: var(--glass-panel);
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    margin-bottom: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.panel-inner {
    padding: 1.12rem 1.15rem;
    min-width: 0;
}

.panel h2 {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.94);
    letter-spacing: 0.01em;
    font-weight: 750;
}

.panel-subtitle {
    margin: 0.34rem 0 0;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.88rem;
    line-height: 1.45;
}

.global-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.field {
    display: grid;
    gap: 0.42rem;
}

.field > span,
.field label > span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field input[type="number"],
.field select,
.field input[type="text"],
.field input[type="search"] {
    width: 100%;
    height: 2.8rem;
    border-radius: 14px;
    border: 1px solid var(--glass-line-strong);
    background: var(--glass-fill);
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.55rem 0.85rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.field input:focus-visible,
.field select:focus-visible {
    outline: none;
    border-color: rgba(91, 159, 237, 0.55);
    box-shadow: 0 0 0 3px rgba(91, 159, 237, 0.18);
}

.toggles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.88rem;
    font-weight: 700;
    min-height: 3.4rem;
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    border: 1px solid var(--glass-line);
    background: var(--glass-fill);
}

.toggle input {
    width: 16px;
    height: 16px;
}

.panel-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.55rem 1rem;
    font-weight: 750;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    min-height: 2.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(91, 159, 237, 0.55);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(91, 159, 237, 0.24);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.96);
}

.btn-danger {
    border-color: rgba(251, 113, 133, 0.32);
    background: rgba(190, 24, 93, 0.1);
    color: #ffd4dd;
}

.btn-pause {
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(217, 119, 6, 0.1);
    color: #fde68a;
}

.btn-pause:hover {
    border-color: rgba(252, 211, 77, 0.48);
}

.status {
    color: #93c5fd;
    font-size: 0.85rem;
    min-height: 1.1rem;
}

.status.error {
    color: #fca5a5;
}

.cards-grid {
    margin-top: 0.9rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
    max-width: 100%;
}

.item-alert-card {
    border: 1px solid var(--surface-border, rgba(148, 163, 184, 0.16));
    border-radius: 22px;
    padding: 1rem;
    background: var(--glass-panel);
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 0;
    overflow: hidden;
}

.item-alert-card.is-paused {
    border-color: rgba(251, 191, 36, 0.28);
}

.card-head {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0.25rem;
}

.card-icon img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.card-title {
    min-width: 0;
}

.card-title a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
}

.card-title a:hover {
    color: #7dd3fc;
}

.card-subtitle {
    margin-top: 0.24rem;
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.78rem;
    line-height: 1.35;
}

.active-rules {
    border: 1px solid var(--glass-line);
    border-radius: 16px;
    background: var(--glass-fill);
    padding: 0.8rem 0.85rem;
    display: grid;
    gap: 0.55rem;
}

.active-rules-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
}

.active-rules-title {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.active-rules-mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    border: 1px solid var(--glass-line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.active-rules-list {
    margin: 0;
    padding-left: 1.05rem;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.82rem;
    line-height: 1.35;
    display: grid;
    gap: 0.25rem;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.metrics-active-rules {
    border-top: none;
    padding-top: 0;
}

.metrics > div {
    background: var(--glass-fill);
    border: 1px solid var(--glass-line);
    border-radius: 16px;
    padding: 0.75rem 0.8rem;
    min-width: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.metric-label {
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.22rem;
}

.metric-value {
    color: rgba(255, 255, 255, 0.94);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.threshold-list {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    padding-top: 0.55rem;
    display: grid;
    gap: 0.3rem;
}

.threshold-row {
    display: flex;
    justify-content: space-between;
    gap: 0.55rem;
    font-size: 0.8rem;
}

.threshold-row span:first-child {
    color: #8fa0bb;
}

.threshold-row span:last-child {
    color: #d9e6ff;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 0.55rem;
    min-width: 0;
    margin-top: auto;
    padding-top: 0.1rem;
}

.card-actions .btn {
    flex: 1;
    padding: 0.55rem 0.7rem;
    min-width: 0;
}

.empty-state {
    border: 1px dashed var(--glass-line-strong);
    border-radius: 18px;
    padding: 1rem 1.05rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.92rem;
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
}

.item-search-shell {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.65rem;
}

.item-search-field {
    max-width: 420px;
}

.item-search-status {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.86rem;
    min-height: 1.1rem;
}

.item-search-status.error {
    color: #fca5a5;
}

.search-results-grid {
    margin-top: 0.7rem;
}

.item-alert-card-search {
    border-color: rgba(91, 159, 237, 0.2);
}

.alert-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.54);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.alert-modal-backdrop[hidden] {
    display: none !important;
}

.alert-modal {
    width: min(560px, 100%);
    border-radius: 22px;
    border: 1px solid var(--surface-border, rgba(148, 163, 184, 0.16));
    background: linear-gradient(180deg, var(--surface-bg-top, rgba(255, 255, 255, 0.035)) 0%, var(--surface-bg-bottom, rgba(255, 255, 255, 0.015)) 100%);
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    padding: 1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    position: relative;
}

.alert-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0) 24%),
        radial-gradient(260px 180px at 20% 0%, rgba(255, 255, 255, 0.035), transparent 72%);
    pointer-events: none;
}

.alert-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 0.2rem 0 0.25rem;
}

.alert-modal-head h3 {
    margin: 0;
    color: #fff;
    font-size: 1.12rem;
}

.alert-modal-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.alert-modal-title-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.alert-modal-title-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.alert-modal-close {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    color: rgba(255, 255, 255, 0.72);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 14px;
    font-size: 1.15rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(91, 159, 237, 0.35);
}

.alert-modal-live {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.022) 100%);
    padding: 0.8rem;
    display: grid;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

.alert-modal-live-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alert-modal-live-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}

.alert-modal-live-item {
    min-width: 0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 0.75rem 0.8rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.alert-modal-live-item span {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.alert-modal-live-item strong {
    display: block;
    color: #f8fafc;
    font-size: 0.86rem;
    line-height: 1.35;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.alert-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.022) 100%);
    position: relative;
    z-index: 1;
}

.trigger-mode-field {
    align-self: start;
}

.trigger-mode-dropdown {
    position: relative;
    width: 100%;
}

.trigger-mode-button {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.92);
    width: 100%;
    height: 2.8rem;
    border-radius: 14px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 650;
    line-height: calc(2.8rem - 2px);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2rem 0 0.75rem;
    margin: 0;
    vertical-align: middle;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
}

.trigger-mode-button::after {
    content: '\25BE';
    position: absolute;
    right: 0.72rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.85;
    font-size: 0.8rem;
    pointer-events: none;
}

.trigger-mode-dropdown.active .trigger-mode-button::after {
    content: '\25B4';
}

.trigger-mode-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(91, 159, 237, 0.35);
}

.trigger-mode-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 220px;
    background: linear-gradient(180deg, rgba(8, 12, 26, 0.98) 0%, rgba(5, 8, 20, 0.96) 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    padding: 6px;
    display: none;
    z-index: 1250;
    box-shadow: var(--glass-shadow);
}

.trigger-mode-dropdown.active .trigger-mode-menu {
    display: block;
}

.trigger-mode-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: #E5E7EB;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: left;
    display: block;
    user-select: none;
}

.trigger-mode-option:hover,
.trigger-mode-option:focus-visible {
    background: rgba(91, 159, 237, 0.18);
    color: #FFFFFF;
    outline: none;
}

.trigger-mode-option.is-selected {
    background: rgba(91, 159, 237, 0.16);
    color: #FFFFFF;
}

.alert-modal-note {
    min-height: 1.1rem;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.86rem;
    position: relative;
    z-index: 1;
}

.alert-modal-note.error {
    color: #fca5a5;
}

.alert-modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 0.1rem 0 0;
    margin-top: 0.05rem;
    border: none;
    border-radius: 0;
    background: transparent;
}

.alert-modal-actions-right {
    display: flex;
    gap: 0.55rem;
}

@media (max-width: 980px) {
    .navbar {
        padding: 0.8rem 0.9rem;
    }

    .navbar-brand {
        font-size: 1.08rem;
    }

    .navbar-links {
        gap: 0.7rem;
    }

    .navbar-links > a {
        font-size: 0.86rem;
    }

    /* Prevent iOS/Safari auto-zoom on form focus */
    .field input[type="number"],
    .field input[type="search"],
    .field input[type="text"],
    .field select,
    .trigger-mode-button {
        font-size: 16px;
    }
}

@media (max-width: 860px) {
    .navbar-links > a .nav-icon {
        display: none;
    }

    .global-grid,
    .alert-modal-grid {
        grid-template-columns: 1fr;
    }

    .toggles {
        grid-template-columns: 1fr;
    }

    .panel-inner {
        padding: 1rem;
    }

    .alert-modal-live-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .navbar-actions {
        gap: 0.8rem;
    }

    .navbar-links {
        gap: 0.55rem;
    }

    .navbar-links > a {
        font-size: 0.8rem;
    }

    .item-alerts-page {
        padding: 0.95rem 0.72rem 1.7rem;
    }

    .hero {
        margin-bottom: 1.15rem;
        gap: 0.75rem;
    }

    .item-alerts-page .panel {
        border-radius: 22px;
        margin-bottom: 0.9rem;
    }

    .item-alerts-page .panel-inner {
        padding: 1rem;
    }

    .item-alerts-page .panel h2 {
        font-size: 0.95rem;
    }

    .item-alerts-page .panel-subtitle {
        margin-top: 0.3rem;
        font-size: 0.82rem;
    }

    .global-grid {
        margin-top: 0.75rem;
        gap: 0.7rem;
    }

    .item-search-field {
        max-width: none;
    }

    .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    .item-alert-card {
        border-radius: 22px;
        padding: 0.95rem;
    }

    .item-alert-card[data-has-alert="1"] {
        grid-column: 1 / -1;
    }

    .item-alert-card[data-has-alert="0"],
    .item-alert-card-search {
        min-height: 222px;
    }

    .item-alert-card[data-has-alert="0"] .card-head,
    .item-alert-card-search .card-head {
        flex-direction: column;
        gap: 0.45rem;
        align-items: center;
        text-align: center;
        min-height: 82px;
    }

    .item-alert-card[data-has-alert="0"] .card-title,
    .item-alert-card-search .card-title {
        width: 100%;
    }

    .item-alert-card[data-has-alert="0"] .card-title a,
    .item-alert-card-search .card-title a {
        display: -webkit-box;
        font-size: 0.8rem;
        line-height: 1.2;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        max-width: 100%;
        min-height: 1.95rem;
    }

    .item-alert-card[data-has-alert="0"] .card-subtitle,
    .item-alert-card-search .card-subtitle {
        margin-top: 0.18rem;
        font-size: 0.68rem;
        line-height: 1.2;
        min-height: 0.75rem;
    }

    .item-alert-card[data-has-alert="0"] .card-icon,
    .item-alert-card-search .card-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        margin: 0 auto;
    }

    .item-alert-card[data-has-alert="0"] .card-icon img,
    .item-alert-card-search .card-icon img {
        width: 30px;
        height: 30px;
    }

    .item-alert-card[data-has-alert="0"] .metrics,
    .item-alert-card-search .metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .item-alert-card[data-has-alert="0"] .metrics > div,
    .item-alert-card-search .metrics > div {
        padding: 0.58rem 0.55rem;
        border-radius: 14px;
    }

    .item-alert-card[data-has-alert="0"] .metric-label,
    .item-alert-card-search .metric-label {
        font-size: 0.6rem;
        margin-bottom: 0.14rem;
    }

    .item-alert-card[data-has-alert="0"] .metric-value,
    .item-alert-card-search .metric-value {
        font-size: 0.76rem;
        line-height: 1.05;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .item-alert-card[data-has-alert="0"] .card-actions,
    .item-alert-card-search .card-actions {
        margin-top: auto;
    }

    .item-alert-card[data-has-alert="0"] .card-actions .btn,
    .item-alert-card-search .card-actions .btn {
        width: 100%;
        min-height: 2.5rem;
        font-size: 0.8rem;
        padding: 0.45rem 0.55rem;
    }

    .alert-modal-backdrop {
        align-items: flex-start;
        padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem max(0.5rem, env(safe-area-inset-bottom));
    }

    .alert-modal {
        width: 100%;
        border-radius: 20px;
        padding: 0.95rem;
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1rem);
        background: linear-gradient(180deg, var(--surface-bg-top, rgba(255, 255, 255, 0.035)) 0%, var(--surface-bg-bottom, rgba(255, 255, 255, 0.015)) 100%);
        backdrop-filter: blur(18px);
    }

    .alert-modal-head {
        align-items: flex-start;
        padding-bottom: 0.2rem;
    }

    .alert-modal-head h3 {
        font-size: 1.02rem;
        line-height: 1.25;
    }

    .alert-modal-title-wrap {
        flex: 1 1 auto;
        min-width: 0;
    }

    .alert-modal-live-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .alert-modal-grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        padding: 0.8rem;
    }

    .alert-modal-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.75rem;
    }

    .alert-modal-actions-right {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .alert-modal-actions .btn {
        min-height: 2.7rem;
    }
}

@media (max-width: 430px) {
    .panel-suggested .cards-grid,
    .search-results-grid {
        grid-template-columns: 1fr;
    }

    .item-alert-card[data-has-alert="0"],
    .item-alert-card-search {
        min-height: 0;
    }

    .item-alert-card[data-has-alert="0"] .card-head,
    .item-alert-card-search .card-head {
        min-height: 0;
    }
}
