body {
    background: #f3f3f3;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-text);
    font-weight: 400;
    line-height: 1.5;
}

/* Public header (match admin look) */
.app-header {
    background: #1e3a8a;
    color: #fff;
}

.app-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: .3px;
}

.app-header-brand img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.app-header-brand span {
    font-size: 1.35rem;
    line-height: 1.1;
}

/* Responsive header/nav refinements */
@media (max-width: 1024px) {
    .app-header-inner {
        padding: 10px 16px;
    }

    .app-header-brand img {
        width: 42px;
        height: 42px;
    }

    .app-header-brand span {
        font-size: 1.2rem;
    }
}

@media (max-width: 820px) {
    .nav-underline {
        gap: 12px;
    }

    .nav-underline--header {
        gap: 10px;
    }

    .nav-underline--header a {
        padding: 9px 2px;
    }

    .filters select {
        min-width: 160px;
    }
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Mobile burger + drawer (shared public/admin) */
.app-burger-btn {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.app-burger-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.app-burger-icon {
    width: 20px;
    height: 14px;
    position: relative;
    display: inline-block;
}

.app-burger-icon::before,
.app-burger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.app-burger-icon::before {
    top: 0;
    box-shadow: 0 6px 0 currentColor;
}

.app-burger-icon::after {
    bottom: 0;
}

.app-nav-overlay {
    display: none;
}

.app-nav-drawer {
    display: block;
}

.app-nav-drawer-top {
    display: none;
}

body.drawer-scroll-lock {
    overflow: hidden;
}

.app-header-user {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-right: 6px;
    font-family: var(--font-text);
    display: none;
}

/* Navigation underline animation (from center to edges) */
.nav-underline {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 18px;
    align-items: center;
}

.nav-underline>li {
    margin: 0;
    padding: 0;
    display: flex;
}

/* Use this variant when you want a visible baseline (e.g. tabs) */
.nav-underline--tabs {
    border-bottom: 2px solid #e2e8f0;
}

.nav-underline a {
    display: inline-block;
    padding: 10px 2px;
    color: #334155;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 600;
    position: relative;
}

/* Header message icon + badge */
.nav-underline a.nav-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: currentColor;
}

.nav-icon svg {
    display: block;
}

.nav-badge {
    position: absolute;
    top: 6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
    font-family: var(--font-text);
    box-shadow: 0 0 0 2px #1e3a8a;
    pointer-events: none;
}

.nav-underline a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 3px;
    background: #1e3a8a;
    border-radius: 3px 3px 0 0;
    transform-origin: center;
    transform: scaleX(0);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-underline a:hover {
    color: #1e3a8a;
}

.nav-underline a:hover::after,
.nav-underline a.active::after {
    transform: scaleX(1);
    opacity: 1;
}

.nav-underline a.active {
    color: #1e3a8a;
}

/* Header variant (white on navy) */
.nav-underline--header {
    gap: 14px;
}

.nav-underline--header a {
    color: rgba(255, 255, 255, 0.92);
}

.nav-underline--header a:hover,
.nav-underline--header a.active {
    color: #ffffff;
}

.nav-underline--header a::after {
    background: rgba(255, 255, 255, 0.95);
}

/* Auth-based nav visibility (prevents header flicker on navigation) */
.nav-only-logged-in,
.nav-only-admin {
    display: none;
}

html.is-logged-in .nav-only-logged-out {
    display: none;
}

html.is-logged-in .nav-only-logged-in {
    display: flex;
}

html.is-admin .nav-only-admin {
    display: flex;
}

:root {
    --font-text: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    --font-heading: 'Oswald', 'Source Sans 3', 'Source Sans Pro', Arial, sans-serif;

    --control-height: 38px;
    --control-radius: 6px;
    --control-border: #cbd5e1;
    --control-bg: #ffffff;
    --control-bg-disabled: #f1f5f9;
    --control-text: #0f172a;
    --control-placeholder: #94a3b8;
    --control-focus: #2563eb;
    --control-focus-ring: rgba(37, 99, 235, 0.18);

    --btn-height: 38px;
    --btn-radius: 6px;
    --btn-font: var(--font-heading);
    --btn-primary: #2563eb;
    --btn-primary-hover: #1d4ed8;
    --btn-success: #16a34a;
    --btn-success-hover: #15803d;
    --btn-danger: #dc2626;
    --btn-danger-hover: #b91c1c;
    --btn-muted: #475569;
    --btn-muted-hover: #334155;
    --btn-navy: #1e3a8a;
    --btn-navy-hover: #1e40af;
    --btn-teal: #0f766e;
    --btn-teal-hover: #115e59;
    --btn-ghost-bg: #f8fafc;
    --btn-ghost-border: #cbd5e1;
    --btn-ghost-text: #0f172a;
}

/* Unified buttons */
.btn,
button {
    height: var(--btn-height);
    border: none;
    border-radius: var(--btn-radius);
    padding: 0 14px;
    background: var(--btn-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.02s;
    font-family: var(--btn-font);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
}

/* Subtle sticky watermark (bottom-left) */
.app-watermark {
    position: fixed;
    left: 5px;
    bottom: 5px;
    z-index: 50;
    pointer-events: none;
    user-select: none;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    font-family: var(--font-text, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: .6px;
    text-transform: uppercase;

    color: rgba(15, 23, 42, .22);
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(15, 23, 42, .06);
    border-left: none;
    border-bottom: none;
    border-radius: 0 10px 0 0;
    padding: 5px 7px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
    backdrop-filter: blur(2px);
}

.app-watermark-line {
    white-space: nowrap;
}

.app-watermark-name {
    font-weight: 700;
    color: rgba(15, 23, 42, .18);
}

@media (prefers-reduced-transparency: reduce) {
    .app-watermark {
        backdrop-filter: none;
        background: rgba(255, 255, 255, .26);
    }
}

.btn:hover,
button:hover {
    background: var(--btn-primary-hover);
}

.btn:active,
button:active {
    transform: translateY(1px);
}

.btn:disabled,
button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn--primary {
    background: var(--btn-primary);
}

.btn--primary:hover {
    background: var(--btn-primary-hover);
}

.btn--success {
    background: var(--btn-success);
}

.btn--success:hover {
    background: var(--btn-success-hover);
}

.btn--danger {
    background: var(--btn-danger);
}

.btn--danger:hover {
    background: var(--btn-danger-hover);
}

.btn--muted {
    background: var(--btn-muted);
}

.btn--muted:hover {
    background: var(--btn-muted-hover);
}

.btn--navy {
    background: var(--btn-navy);
}

.btn--navy:hover {
    background: var(--btn-navy-hover);
}

.btn--teal {
    background: var(--btn-teal);
}

.btn--teal:hover {
    background: var(--btn-teal-hover);
}

.btn--ghost {
    background: var(--btn-ghost-bg);
    color: var(--btn-ghost-text);
    border: 1px solid var(--btn-ghost-border);
}

.btn--ghost:hover {
    background: #eef2f7;
}

.btn--sm {
    height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn--icon {
    width: 40px;
    padding: 0;
}

.btn--icon-sm {
    width: 34px;
    height: 34px;
    padding: 0;
}

.btn--icon-xs {
    width: 28px;
    height: 28px;
    padding: 0;
}

.btn--icon-xs svg {
    display: block;
}

/* Admin: keep action icons in one row */
.admin-actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.admin-actions-cell--wrap {
    flex-wrap: wrap;
    white-space: normal;
    overflow: visible;
}

.btn--field {
    margin-bottom: 10px;
}

.btn--plus {
    font-size: 22px;
    font-weight: 800;
}

/* SweetAlert2 action buttons (confirm/cancel) */
.swal2-popup .swal2-actions button.swal2-confirm {
    height: var(--btn-height) !important;
    border-radius: var(--btn-radius) !important;
    background: var(--btn-primary) !important;
    font-family: var(--btn-font) !important;
    font-weight: 700 !important;
}

.swal2-popup .swal2-actions button.swal2-confirm:hover {
    background: var(--btn-primary-hover) !important;
}

.swal2-popup .swal2-actions button.swal2-cancel {
    height: var(--btn-height) !important;
    border-radius: var(--btn-radius) !important;
    background: var(--btn-muted) !important;
    color: #fff !important;
    font-family: var(--btn-font) !important;
    font-weight: 700 !important;
}

.swal2-popup .swal2-actions button.swal2-cancel:hover {
    background: var(--btn-muted-hover) !important;
}

/* Unified inputs/selects/textarea (public + admin) */
.ui-control,
input:not([type]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
    box-sizing: border-box;
    width: 100%;
    font-family: var(--font-text);
    font-size: 0.95rem;
    color: var(--control-text);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    padding: 8px 12px;
    outline: none;
}

input:not([type]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
select {
    height: var(--control-height);
}

textarea {
    min-height: 100px;
    resize: vertical;
    padding: 10px 12px;
}

.ui-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--control-placeholder);
}

.ui-control:focus,
input:not([type]):focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--control-focus);
    box-shadow: 0 0 0 3px var(--control-focus-ring);
}

.ui-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    background: var(--control-bg-disabled);
    color: #64748b;
    cursor: not-allowed;
}

/* Filter bar (main page) */
.filters {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.filters label {
    font-weight: 700;
    color: #0f172a;
    font-family: var(--font-heading);
}

.filters select {
    width: auto;
    min-width: 220px;
}

.container {
    max-width: 1200px;
    margin: 24px auto 40px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.title {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Public services pagination */
.usluge-pagination {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.usluge-pagination .btn {
    min-width: 40px;
}

.usluge-pagination-ellipsis {
    color: #64748b;
    font-weight: 700;
    padding: 0 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

thead tr {
    background: #1e3a8a;
}

th,
td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    cursor: default;
}

th {
    font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: .5px;
    color: #ffffff;
}

tr:hover {
    background: #f1f5f9;
}

thead tr:hover {
    background: #1e3a8a;
}

/* Two-row service layout (desktop/tablet) */
tr.usluga-kategorije-row td {
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-top: 1px solid #cbd5e1;
    border-left: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
}

tr.usluga-podaci-row td {
    background: #fff;
    border-bottom: 1px solid #cbd5e1;
}

tr.usluga-podaci-row td:first-child {
    border-left: 1px solid #cbd5e1;
}

tr.usluga-podaci-row td:last-child {
    border-right: 1px solid #cbd5e1;
}

/* Hover for a whole service (both rows) */
tr.usluga-hover.usluga-kategorije-row td {
    background: #cbd5e1;
}

tr.usluga-hover.usluga-podaci-row td {
    background: #e5e7eb;
}

.usluga-kategorije-inline {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* (button base moved to unified buttons section above) */

/* Responsive utilities */
@media (max-width: 1024px) {
    .container {
        padding: 16px;
    }

    .title {
        font-size: 1.9rem;
    }

    th,
    td {
        padding: 10px 6px;
    }
}

@media (max-width: 820px) {
    .filters {
        flex-wrap: wrap !important;
    }

    .filters select {
        min-width: 180px;
    }

    .title {
        font-size: 1.7rem;
    }
}

/* Mobile table -> cards */
@media (max-width: 640px) {
    table.responsive thead {
        display: none;
    }

    table.responsive,
    table.responsive tbody,
    table.responsive tr,
    table.responsive td {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    table.responsive tr {
        background: #fff;
        margin-bottom: 14px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        padding: 8px 10px;
        box-sizing: border-box;
    }

    /* Two-row layout: visually merge pairs into a single card */
    table.responsive tr.usluga-kategorije-row {
        margin-bottom: 0;
        border-bottom: none;
        border-radius: 6px 6px 0 0;
        padding-bottom: 4px;
    }

    table.responsive tr.usluga-kategorije-row td {
        background: #e2e8f0;
    }

    table.responsive tr.usluga-kategorije-row+tr.usluga-podaci-row {
        border-top: none;
        border-radius: 0 0 6px 6px;
        padding-top: 4px;
    }

    table.responsive td {
        border: none;
        padding: 6px 4px;
        position: relative;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    table.responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        font-family: var(--font-heading);
        display: block;
        color: #334155;
        margin-bottom: 2px;
    }

    table.responsive td:last-child {
        margin-top: 6px;
    }

    /* Header: keep nav usable on small screens */
    .app-header-brand span {
        font-size: 1.1rem;
    }

    /* Burger menu opens fullscreen drawer */
    .app-burger-btn {
        display: inline-flex;
    }

    .app-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1990;
        background: rgba(2, 6, 23, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    html.drawer-open .app-nav-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .app-nav-drawer {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 2000;
        background: #0b1220;
        color: #fff;
        padding: 14px 14px 18px;
        box-sizing: border-box;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    html.drawer-open .app-nav-drawer {
        transform: translateX(0);
    }

    .app-nav-drawer-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-bottom: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .app-nav-drawer-title {
        font-family: var(--font-heading);
        font-weight: 700;
        letter-spacing: .4px;
        text-transform: uppercase;
        font-size: 0.95rem;
        color: rgba(255, 255, 255, 0.92);
    }

    .app-nav-drawer-close {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.10);
        color: #fff;
        font-size: 28px;
        line-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .app-nav-drawer-close:hover {
        background: rgba(255, 255, 255, 0.16);
    }

    .app-nav-drawer nav {
        width: 100%;
        flex: 1 1 auto;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-nav-drawer .nav-underline {
        width: 100%;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .app-nav-drawer .nav-underline>li {
        display: block;
    }

    .app-nav-drawer .nav-underline a {
        width: 100%;
        padding: 14px 10px;
        color: rgba(255, 255, 255, 0.92);
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        box-sizing: border-box;
    }

    .app-nav-drawer .nav-underline a::after {
        display: none;
    }

    .app-nav-drawer .nav-badge {
        box-shadow: none;
        top: 10px;
        right: 8px;
    }

    /* Filters: stack full-width */
    .filters {
        gap: 10px;
    }

    .filters select {
        width: 100%;
        min-width: 0;
    }

    .container {
        margin: 14px 10px 28px;
        padding: 14px;
        border-radius: 10px;
    }
}

/* Smaller phones */
@media (max-width: 420px) {
    .title {
        font-size: 1.5rem;
    }

    button {
        padding: 6px 12px;
    }

    .filters label {
        width: 100%;
    }

    .filters button#nova-usluga-btn {
        width: 100%;
        margin-left: 0 !important;
    }
}

/* Modal custom */
.swal2-popup.swal2-nova-usluga {
    max-width: 760px !important;
    width: 90% !important;
    padding: 20px !important;
    box-sizing: border-box;
}

.swal2-popup.swal2-nova-usluga .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

.swal2-popup.swal2-nova-usluga .swal2-html-container div[style*="overflow:auto"] {
    overflow-x: hidden !important;
}

.swal2-popup.swal2-nova-usluga .swal2-html-container * {
    box-sizing: border-box;
    max-width: 100%;
}

.swal2-popup.swal2-nova-usluga label {
    min-width: 0;
}

.swal2-popup.swal2-nova-usluga input.swal2-input,
.swal2-popup.swal2-nova-usluga textarea.swal2-textarea,
.swal2-popup.swal2-nova-usluga select {
    margin: 4px 0 10px 0 !important;
    width: 100% !important;
}

/* Auth modals (login/register) */
.swal2-popup.swal2-auth {
    max-width: 560px !important;
    width: 92% !important;
    padding: 18px !important;
    box-sizing: border-box;
}

.swal2-popup.swal2-auth .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

.swal2-popup.swal2-auth .swal2-html-container * {
    box-sizing: border-box;
    max-width: 100%;
}

.swal2-popup.swal2-auth input.swal2-input,
.swal2-popup.swal2-auth textarea.swal2-textarea,
.swal2-popup.swal2-auth select {
    margin: 4px 0 10px 0 !important;
    width: 100% !important;
}

@media (max-width: 640px) {
    .swal2-popup.swal2-nova-usluga div[style*="display:grid"] {
        display: block !important;
    }
}

@media (max-width: 640px) {
    .app-header-inner {
        flex-direction: row;
        align-items: center;
    }

    .app-header-actions {
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
}