/* Dnevni – app styles */
:root {
    --bg: #e8eeec;
    --bg-deep: #0f1f1c;
    --surface: #f7faf8;
    --ink: #14211e;
    --muted: #5a6e68;
    --line: #c5d4ce;
    --accent: #1d6b56;
    --accent-deep: #145040;
    --accent-soft: #d5ebe3;
    --warn: #b45309;
    --danger: #b42318;
    --today: #1d6b56;
    --selected: #0f3d32;
    --has: #f0e6c8;
    --radius: 14px;
    --shadow: 0 18px 40px rgba(15, 31, 28, 0.12);
    --font-display: "Sora", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    line-height: 1.45;
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 1.65rem;
    color: var(--accent-deep);
}

select.field-select,
.field select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

/* —— Login —— */
.page-login {
    display: grid;
    place-items: center;
    align-content: safe center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-deep);
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(29, 107, 86, 0.45), transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 75%, rgba(180, 140, 60, 0.18), transparent 50%),
        linear-gradient(165deg, #0a1614 0%, #143029 48%, #0f1f1c 100%);
    animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    from { filter: saturate(1) brightness(1); }
    to { filter: saturate(1.15) brightness(1.05); }
}

.login-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
}

.login-form {
    background: var(--surface);
    border-radius: calc(var(--radius) + 6px);
    padding: 2.4rem 2rem 2rem;
    box-shadow: var(--shadow);
    animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-form .brand {
    display: block;
    margin-bottom: 1.25rem;
    font-size: 2rem;
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.login-lead {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
}

.field span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field input,
.field select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: auto;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29, 107, 86, 0.18);
}

.field input:disabled,
.field select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #eef2f0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* —— Setup (više kartica, scrollabilno) —— */
html:has(.page-setup),
html:has(.page-setup) body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.page-setup {
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    padding: 1.5rem 1rem 4rem;
    position: relative;
    overflow: visible;
    background: var(--bg-deep);
}

.setup-wrap {
    position: relative;
    z-index: 1;
    width: min(100%, 540px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setup-card {
    background: var(--surface);
    border-radius: calc(var(--radius) + 6px);
    padding: 1.75rem 1.5rem 1.9rem;
    box-shadow: var(--shadow);
}

.setup-card h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--accent-deep);
}

.setup-card .lead {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1.1rem;
    line-height: 1.5;
}

.setup-card .brand {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
}

.secret-box {
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    background: var(--accent-soft);
    color: var(--accent-deep);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin: 0.75rem 0 0;
}

.user-list {
    list-style: none;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.user-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.user-list li:last-child { border-bottom: none; }

.setup-warn {
    color: var(--warn);
    font-size: 0.85rem;
    margin-top: 1.1rem;
    line-height: 1.45;
}

.setup-ok {
    background: #d5ebe3;
    color: #145040;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.setup-err {
    background: #fce8e6;
    color: #7a1f16;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-deep);
    white-space: nowrap;
}

.badge-admin { background: #cfe5db; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-deep);
    box-shadow: 0 8px 20px rgba(29, 107, 86, 0.28);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid rgba(180, 35, 24, 0.35);
}

.btn-danger:hover { background: rgba(180, 35, 24, 0.08); }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }

.btn-block { width: 100%; margin-top: 0.5rem; padding: 0.95rem; }

.form-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

/* —— App shell —— */
.page-app {
    background:
        linear-gradient(180deg, #dfe8e4 0%, var(--bg) 28%),
        var(--bg);
}

.app-header {
    border-bottom: 1px solid var(--line);
    background: rgba(247, 250, 248, 0.92);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.app-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-brand-block { display: flex; flex-direction: column; gap: 0.1rem; }
.app-brand-block .brand { font-size: 1.35rem; line-height: 1.1; }
.app-tagline { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.02em; }

.app-user { display: flex; align-items: center; gap: 0.75rem; }

.user-chip {
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--accent-soft);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.user-chip em {
    font-style: normal;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.role-admin { background: var(--accent); color: #fff; }
.role-user { background: #fff; color: var(--muted); }

.app-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 1.25rem;
    animation: riseIn 0.45s ease both;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 4px 18px rgba(15, 31, 28, 0.05);
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.month-label {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
}

.icon-btn {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
    transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 0.4rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.day-cell {
    aspect-ratio: 1;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.12s, background 0.15s, border-color 0.15s;
    padding: 2px;
}

.day-cell:hover { transform: scale(0.96); background: var(--accent-soft); }
.day-cell.other { color: #9aada5; background: #f0f4f2; }
.day-cell.today { box-shadow: inset 0 0 0 2px var(--today); }
.day-cell.selected {
    background: var(--selected);
    color: #fff;
    border-color: var(--selected);
}
.day-cell.has-amount:not(.selected) {
    background: var(--has);
    border-color: #d4bc7a;
}
.day-cell .amt {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--warn);
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.day-cell.selected .amt { color: #f5d78e; }

.detail-panel {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.detail-date {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
}

.amount-display {
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    color: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.35rem;
    animation: softGlow 4s ease-in-out infinite alternate;
}

@keyframes softGlow {
    from { box-shadow: 0 8px 24px rgba(29, 107, 86, 0.25); }
    to { box-shadow: 0 12px 32px rgba(29, 107, 86, 0.4); }
}

.amount-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
    margin-bottom: 0.35rem;
}

.amount-value {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.admin-edit { display: flex; flex-direction: column; gap: 0.85rem; }
.edit-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.edit-actions .btn { flex: 1; min-width: 110px; }

.hint {
    font-size: 0.9rem;
    color: var(--muted);
    background: #eef3f1;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border-left: 3px solid var(--accent);
}

.month-summary {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
    font-size: 0.9rem;
    color: var(--muted);
}

.month-summary strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--ink);
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    background: var(--ink);
    color: #fff;
    padding: 0.85rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    animation: riseIn 0.3s ease both;
    max-width: min(90vw, 340px);
}

.toast.error { background: var(--danger); }
.toast.info { background: var(--accent-deep); }

@media (max-width: 760px) {
    .app-main { grid-template-columns: 1fr; padding-top: 1rem; }
    .app-header-inner { flex-wrap: wrap; }
    .day-cell { font-size: 0.8rem; border-radius: 8px; }
    .day-cell .amt { font-size: 0.5rem; }
    .amount-value { font-size: 1.5rem; }
}
