/* Shared by public, citizen and admin layouts: fonts, bidi helpers, form renderer, widgets. */
@font-face {
    font-family: 'Noto Sans Thaana';
    src: url('/fonts/NotoSansThaana.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    font-display: swap;
}

/* Thaana font families:
   - Regular/medium body copy (100..599): MV Faseyha ('MC Thaana'), AK Rasmee ('MC Thaana Rasmee'), or Faruma ('MC Thaana Faruma').
   - All bold Dhivehi text (600..900) and all Dhivehi headings ('MC Thaana Heading'): MV Waheed.
   Latin glyphs fall through unicode-range to --mc-latin at their native weight. */
@font-face {
    font-family: 'MC Thaana';
    src: url('/fonts/MV_Faseyha.otf') format('opentype'), local('MV Faseyha');
    font-weight: 100 599;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 130%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana';
    src: url('/fonts/MV_Waheed.otf') format('opentype'), local('MV Waheed');
    font-weight: 600 900;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 112%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana Rasmee';
    src: url('/fonts/AK_Rasmee.otf') format('opentype'), local('AK Rasmee'), local('AK Rasmee 1.9');
    font-weight: 100 599;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 118%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana Rasmee';
    src: url('/fonts/MV_Waheed.otf') format('opentype'), local('MV Waheed');
    font-weight: 600 900;
    unicode-range: U+0780-07BF, U+060C, U+061F, U+061B, U+FDF2;
    size-adjust: 112%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana Faruma';
    src: url('/fonts/Faruma.ttf') format('truetype'), local('Faruma');
    font-weight: 100 599;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 118%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana Faruma';
    src: url('/fonts/MV_Waheed.otf') format('opentype'), local('MV Waheed');
    font-weight: 600 900;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 112%;
    font-display: swap;
}
@font-face {
    font-family: 'MC Thaana Heading';
    src: url('/fonts/MV_Waheed.otf') format('opentype'), local('MV Waheed');
    font-weight: 100 900;
    unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2;
    size-adjust: 112%;
    font-display: swap;
}

:root {
    --mc-primary: #0a6c8f;
    --mc-primary-dark: #07506a;
    --mc-teal: #0f9d8a;
    --mc-navy: #0b2a3c;
    --mc-sand: #f3f8fa;
    --mc-border: #dbe7ec;
    --mc-radius: .85rem;
    --mc-shadow: 0 .25rem 1.25rem rgba(11, 42, 60, .08);
    --mc-latin: system-ui, -apple-system, 'Segoe UI', Roboto;
    --mc-font: 'MC Thaana', 'Noto Sans Thaana', var(--mc-latin), sans-serif;
    --mc-font-heading: 'MC Thaana Heading', 'MC Thaana', 'Noto Sans Thaana', var(--mc-latin), sans-serif;
}

html[data-thaana-font="rasmee"] { --mc-font: 'MC Thaana Rasmee', 'MC Thaana', 'Noto Sans Thaana', var(--mc-latin), sans-serif; }
html[data-thaana-font="faruma"] { --mc-font: 'MC Thaana Faruma', 'MC Thaana', 'Noto Sans Thaana', var(--mc-latin), sans-serif; }

html[lang="dv"] body { line-height: 1.9; letter-spacing: 0; }
html[lang="en"] body { line-height: 1.6; }
html[lang="dv"] .btn, html[lang="dv"] .form-control, html[lang="dv"] .form-select, html[lang="dv"] .nav-link { line-height: 1.8; }

/* widgets that otherwise fall back to the OS (MV Boli) */
button, input, select, textarea, optgroup, .form-control, .form-select, .dropdown-menu, .tooltip, .popover, .toast, .modal,
.leaflet-container, .leaflet-popup-content, .leaflet-control, .leaflet-draw-tooltip { font-family: inherit; }
.ql-container, .ql-container.ql-snow, .ql-editor, .ql-snow .ql-editor,
.ql-toolbar, .ql-toolbar.ql-snow, .ql-tooltip, .ql-snow .ql-tooltip,
.ql-snow .ql-picker, .ql-snow .ql-picker-label, .ql-snow .ql-picker-options { font-family: var(--mc-font) !important; }
.ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4, .ql-editor h5, .ql-editor h6,
.ql-editor b, .ql-editor strong { font-family: var(--mc-font-heading) !important; font-synthesis-weight: none; }
.leaflet-container { font-family: inherit; }
.thaana-input, [data-thaana="true"] { direction: rtl; text-align: right; font-family: var(--mc-font); }

bdi { unicode-bidi: isolate; }
.ltr-input, input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], input[type=date], input[type=datetime-local] { direction: ltr; }
html[dir="rtl"] input[type=email], html[dir="rtl"] input[type=tel], html[dir="rtl"] input[type=url] { text-align: right; }

.table > :not(caption) > * > * { vertical-align: middle; }
.table-actions { white-space: nowrap; }
.ql-editor { min-height: 220px; font-size: 1rem; line-height: 1.75; }
.ql-editor[dir="rtl"], [data-rtl="true"] .ql-editor, [data-rtl="1"] .ql-editor { direction: rtl; text-align: right; line-height: 1.95; font-size: 1.05rem; }
.ql-editor[dir="rtl"] h1, .ql-editor[dir="rtl"] h2, .ql-editor[dir="rtl"] h3, .ql-editor[dir="rtl"] h4, .ql-editor[dir="rtl"] h5, .ql-editor[dir="rtl"] h6 { line-height: 1.7; letter-spacing: 0; }
.ql-editor[dir="rtl"].ql-blank::before { font-family: var(--mc-font) !important; font-style: normal; text-align: right; }
.bilingual .dv-col label { font-weight: 600; }
.img-preview { max-height: 90px; border-radius: .5rem; border: 1px solid var(--mc-border); }
.toast-container { z-index: 2000; }
.notif-bell .badge { position: absolute; top: 0; inset-inline-end: 0; transform: translate(30%, -30%); }
.mc-lang-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; white-space: nowrap; }
.mc-lang-toggle .bi,
.mc-lang-toggle .mp-ico { font-size: .92rem; line-height: 1; flex-shrink: 0; }
.mc-lang-toggle .mc-lang-dv { font-family: var(--mc-font-heading); font-weight: 500; font-synthesis: none; font-size: .86rem; line-height: 1.25; letter-spacing: 0; }
.mc-lang-toggle .mc-lang-en { font-family: var(--mc-latin), sans-serif; font-weight: 500; font-size: .82rem; line-height: 1.2; }

/* Global Custom SVG Sprite Icons (.mp-ico) */
.mp-ico {
    width: 1.08em;
    height: 1.08em;
    display: inline-block;
    vertical-align: -0.16em;
    flex-shrink: 0;
}
.mp-ico-xs {
    width: 0.78rem;
    height: 0.78rem;
}
.mp-ico-lg {
    width: 1.25rem;
    height: 1.25rem;
}
.mp-ico .mp-svg-tone {
    fill: currentColor;
    fill-opacity: 0.12;
}

/* dynamic form renderer */
.dyn-pill { border: 1px solid var(--mc-border); background: var(--bs-body-bg, #fff); color: var(--bs-body-color, var(--mc-navy)); border-radius: 2rem; }
.dyn-pill .num { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--mc-sand); color: #1d3442; font-size: .8rem; margin-inline-end: .25rem; }
.dyn-pill.active { background: var(--mc-primary); color: #fff; border-color: var(--mc-primary); }
.dyn-pill.active .num { background: rgba(255, 255, 255, .25); color: #fff; }
.dyn-pill.done .num { background: var(--mc-teal); color: #fff; }
.kc-bilingual-label { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0.42rem; }
.kc-bilingual-label .kc-lbl-sep { color: #94a3b8; font-weight: 400; }
.kc-dv-heading { font-family: var(--mc-font-heading); font-synthesis: none; line-height: 1.7; }
.kc-dv-body { font-family: var(--mc-font); font-synthesis: none; line-height: 1.75; }
.dyn-map { height: 340px; border-radius: .6rem; border: 1px solid var(--mc-border); z-index: 0; }
.dyn-signature { display: block; width: 100%; height: 160px; border: 2px dashed var(--mc-border); border-radius: .6rem; background: #fff; touch-action: none; cursor: crosshair; }
.dyn-signature.is-invalid { border-color: #dc3545; }
.w-35 { width: 35%; }
.status-badge { font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 3px solid var(--mc-border); }
.timeline li { position: relative; padding: 0 0 1.25rem 1.25rem; }
html[dir="rtl"] .timeline li { padding: 0 1.25rem 1.25rem 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -9px; top: .35rem; width: 15px; height: 15px; border-radius: 50%; background: var(--mc-teal); border: 3px solid var(--bs-body-bg, #fff); box-shadow: 0 0 0 1px var(--mc-border); }
.service-card { display: block; height: 100%; text-decoration: none; color: inherit; }
.mini-map, .full-map { height: 340px; border-radius: 1rem; z-index: 0; }
.full-map { height: calc(100vh - 220px); min-height: 420px; }
.progress-sm { height: .6rem; }
.vote-bar { height: 1rem; border-radius: .5rem; overflow: hidden; display: flex; background: #eee; }
.vote-bar span { display: block; height: 100%; }
mark { padding: 0 .1em; background: #ffe69c; }
.vessel-icon { font-size: 1.6rem; color: #0a6c8f; text-shadow: 0 0 3px #fff; filter: drop-shadow(0 0 2px #fff); }
.gallery-thumb { cursor: zoom-in; height: 140px; object-fit: cover; width: 100%; border-radius: .5rem; }
.aqi-orange { background: #fd7e14; color: #fff; } .aqi-purple { background: #7b2cbf; color: #fff; }

.tooltip, .popover, .modal, .toast, .dropdown-menu { font-family: var(--mc-font); }
.modal-title, .card-title, .header-title, .page-title, .popover-header, b, strong, .fw-bold, .fw-bolder { font-family: var(--mc-font-heading); font-synthesis-weight: none; }
.tooltip { pointer-events: none; }
.tooltip-inner { font-family: var(--mc-font); line-height: 1.8; }

[x-cloak] { display: none !important; }

/* ---------- Notifications Panel (Topbar Dropdown & Full Page) ---------- */
.mc-notif-panel {
    width: 396px;
    max-width: calc(100vw - 1.5rem);
    padding: 0;
    border-radius: 0.95rem;
    border: 1px solid var(--mp-border, var(--bs-border-color, #e2e8f0));
    background: var(--mp-surface, var(--bs-body-bg, #ffffff));
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
    box-shadow: var(--mp-shadow-md, 0 12px 32px -4px rgba(15, 23, 42, 0.14), 0 4px 10px rgba(15, 23, 42, 0.05));
    overflow: hidden;
    margin-top: 0.45rem !important;
    text-align: start;
}

.mc-notif-head {
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid var(--mp-border, var(--bs-border-color, #e2e8f0));
    background: var(--mp-surface, var(--bs-body-bg, #ffffff));
}

.mc-notif-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.mc-notif-title-head {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
}

.mc-notif-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--mp-accent-soft, rgba(2, 132, 199, 0.12));
    color: var(--mp-accent-dark, var(--bs-primary, #0369a1));
}

.mc-notif-mark-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--mp-accent-dark, var(--bs-primary, #0284c7));
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.mc-notif-mark-all:hover {
    background: var(--mp-accent-soft, rgba(2, 132, 199, 0.1));
    color: var(--mp-accent-dark, var(--bs-primary, #0369a1));
}

.mc-notif-mark-all svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.mc-notif-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin-top: 0.65rem;
    padding: 0.22rem;
    border-radius: 0.55rem;
    background: var(--mp-surface-2, var(--bs-tertiary-bg, #f1f5f9));
    border: 1px solid var(--mp-border, var(--bs-border-color, #e2e8f0));
}

.mc-notif-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.32rem 0.65rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
    font-size: 0.79rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.mc-notif-tab:hover {
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
}

.mc-notif-tab.is-active {
    background: var(--mp-surface, var(--bs-body-bg, #ffffff));
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mc-notif-tab-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 17px;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--mp-accent-soft, rgba(2, 132, 199, 0.14));
    color: var(--mp-accent-dark, var(--bs-primary, #0369a1));
}

.mc-notif-list {
    max-height: min(400px, calc(100dvh - 200px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.mc-notif-form {
    margin: 0;
}

.mc-notif-form + .mc-notif-form {
    border-top: 1px solid var(--mp-border, var(--bs-border-color, #e2e8f0));
}

.mc-notif-item,
.mc-notif-page-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.78rem;
    border: 0;
    background: transparent;
    text-align: start;
    color: inherit;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.14s ease;
}

.mc-notif-item {
    padding: 0.85rem 1rem;
}

.mc-notif-page-item {
    padding: 1rem 1.25rem;
}

.mc-notif-item.is-unread,
.mc-notif-page-item.is-unread {
    background: color-mix(in srgb, var(--mp-accent, var(--bs-primary, #0284c7)) 5%, var(--mp-surface, var(--bs-body-bg, #ffffff)));
}

.mc-notif-item:hover,
.mc-notif-page-item:hover {
    background: var(--mp-surface-2, var(--bs-tertiary-bg, #f8fafc));
}

.mc-notif-item.is-unread:hover,
.mc-notif-page-item.is-unread:hover {
    background: color-mix(in srgb, var(--mp-accent, var(--bs-primary, #0284c7)) 9%, var(--mp-surface, var(--bs-body-bg, #ffffff)));
}

.mc-notif-ico {
    width: 36px;
    height: 36px;
    border-radius: 0.62rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.mc-notif-ico svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mc-notif-ico .mc-notif-tone,
.mc-notif-empty-ico .mc-notif-tone {
    fill: currentColor;
    fill-opacity: 0.14;
}

.mc-notif-ico.is-blue { background: #e0f2fe; color: #0369a1; }
.mc-notif-ico.is-green { background: #dcfce7; color: #15803d; }
.mc-notif-ico.is-amber { background: #fef3c7; color: #b45309; }
.mc-notif-ico.is-rose { background: #ffe4e6; color: #be123c; }
.mc-notif-ico.is-violet { background: #ede9fe; color: #6d28d9; }
.mc-notif-ico.is-teal { background: #ccfbf1; color: #0f766e; }
.mc-notif-ico.is-neutral {
    background: var(--mp-surface-2, var(--bs-tertiary-bg, #f1f5f9));
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
}

html[data-bs-theme="dark"] .mc-notif-ico.is-blue { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
html[data-bs-theme="dark"] .mc-notif-ico.is-green { background: rgba(16, 185, 129, 0.16); color: #34d399; }
html[data-bs-theme="dark"] .mc-notif-ico.is-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
html[data-bs-theme="dark"] .mc-notif-ico.is-rose { background: rgba(244, 63, 94, 0.16); color: #fb7185; }
html[data-bs-theme="dark"] .mc-notif-ico.is-violet { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
html[data-bs-theme="dark"] .mc-notif-ico.is-teal { background: rgba(20, 184, 166, 0.16); color: #2dd4bf; }

.mc-notif-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
}

.mc-notif-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
}

.mc-notif-title {
    font-size: 0.875rem;
    line-height: 1.38;
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
}

.mc-notif-page-item .mc-notif-title {
    font-size: 0.95rem;
}

.mc-notif-item.is-unread .mc-notif-title,
.mc-notif-page-item.is-unread .mc-notif-title {
    font-weight: 600;
}

.mc-notif-item.is-read .mc-notif-title,
.mc-notif-page-item.is-read .mc-notif-title {
    font-weight: 500;
    color: var(--mp-ink-2, var(--bs-body-color, #334155));
}

.mc-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mp-accent, var(--bs-primary, #0284c7));
    box-shadow: 0 0 0 3px var(--mp-accent-soft, rgba(2, 132, 199, 0.15));
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.mc-notif-body {
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.48;
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mc-notif-page-item .mc-notif-body {
    font-size: 0.9rem;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}

.mc-notif-time {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    margin-top: 0.1rem;
    font-size: 0.74rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
    opacity: 0.9;
}

.mc-notif-page-item .mc-notif-time {
    font-size: 0.84rem;
}

.mc-notif-time svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.mc-notif-empty {
    padding: 2.25rem 1.25rem;
    text-align: center;
}

.mc-notif-empty-ico {
    width: 46px;
    height: 46px;
    margin: 0 auto 0.7rem;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mp-surface-2, var(--bs-tertiary-bg, #f1f5f9));
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
}

.mc-notif-empty-ico.is-done {
    background: #dcfce7;
    color: #15803d;
}

html[data-bs-theme="dark"] .mc-notif-empty-ico.is-done {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
}

.mc-notif-empty-ico svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mc-notif-empty-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--mp-ink, var(--bs-body-color, #0f172a));
}

.mc-notif-empty-sub {
    margin-top: 0.22rem;
    font-size: 0.82rem;
    color: var(--mp-muted, var(--bs-secondary-color, #64748b));
}

.mc-notif-foot {
    border-top: 1px solid var(--mp-border, var(--bs-border-color, #e2e8f0));
    background: var(--mp-surface, var(--bs-body-bg, #ffffff));
}

.mc-notif-foot-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--mp-accent-dark, var(--bs-primary, #0284c7));
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.mc-notif-foot-link:hover {
    background: var(--mp-surface-2, var(--bs-tertiary-bg, #f8fafc));
    color: var(--mp-accent-dark, var(--bs-primary, #0369a1));
}

.mc-notif-foot-link svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 575.98px) {
    .mp-topbar .notif-bell .mc-notif-panel {
        position: fixed !important;
        inset: auto !important;
        inset-inline: 0.75rem !important;
        top: calc(var(--mp-topbar-h, 64px) + 0.35rem) !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        margin-top: 0 !important;
    }
}
