/* V9.2 klijentski portal /my/ — mobile-first, nezavisan od admin style.css.
   Osnova je 390px ekran; sira polja tek od 600px navise. Sva dodirna polja
   su najmanje 48px visoka. */

:root {
    --cw-bg: #f2f4f8;
    --cw-ink: #14181f;
    --cw-muted: #5b6474;
    --cw-line: #d8dfea;
    --cw-brand: #16233a;
    --cw-accent: #1f6feb;
    --cw-ok-bg: #e4f6e9;
    --cw-ok-line: #7fc794;
    --cw-err-bg: #fdeaea;
    --cw-err-line: #e39b9b;
    --cw-tap: 48px;
}

* { box-sizing: border-box; }

body.cw {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.45;
    background: var(--cw-bg);
    color: var(--cw-ink);
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}
body.cw-impersonating { padding-bottom: 72px; }

/* ---- traka na vrhu ---- */
.cw-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; background: var(--cw-brand); color: #fff; padding: 10px 16px;
}
.cw-brand { display: inline-flex; align-items: center; text-decoration: none; }
.cw-logo { height: 28px; width: auto; display: block; }
button.linklike {
    background: none; border: none; color: #cfe0ff; font: inherit;
    padding: 12px 4px; min-height: var(--cw-tap); cursor: pointer;
}

.cw-main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; }
.cw-h1 { font-size: 1.45rem; margin: 4px 0 14px; }
.muted { color: var(--cw-muted); }
.small { font-size: .88rem; }
.inline { display: inline; }

/* ---- poruke ---- */
.cw-flash {
    max-width: 720px; margin: 12px auto 0; padding: 12px 16px;
    border-radius: 10px; font-weight: 600;
}
.cw-flash.ok { background: var(--cw-ok-bg); border: 1px solid var(--cw-ok-line); color: #17532a; }
.cw-flash.error { background: var(--cw-err-bg); border: 1px solid var(--cw-err-line); color: #7b2020; }

/* ---- plocice ---- */
.cw-tiles { display: grid; grid-template-columns: 1fr; gap: 12px; }
.cw-tile {
    display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto;
    column-gap: 14px; align-items: center;
    background: #fff; border: 1px solid var(--cw-line); border-radius: 14px;
    padding: 18px 16px; min-height: 84px; text-decoration: none; color: inherit;
}
.cw-tile:active { background: #eef3fb; }
.cw-tile-icon { grid-row: 1 / span 2; font-size: 2rem; text-align: center; line-height: 1; }
.cw-tile-label { font-size: 1.2rem; font-weight: 700; }
.cw-tile-line { color: var(--cw-muted); font-size: .95rem; }
.cw-site-foot { text-align: center; color: var(--cw-muted); margin-top: 22px; font-size: .9rem; }

/* ---- forme ---- */
.cw-back {
    display: inline-flex; align-items: center; min-height: var(--cw-tap);
    color: var(--cw-accent); text-decoration: none; font-weight: 600;
}
.cw-card {
    background: #fff; border: 1px solid var(--cw-line); border-radius: 12px;
    padding: 16px; margin-bottom: 14px;
}
fieldset.cw-card { border: 1px solid var(--cw-line); }
legend { font-weight: 700; padding: 0 6px; }

.cw-form label, .cw-card label {
    display: block; margin: 12px 0 6px; font-size: .95rem; font-weight: 600;
}
.cw-form input, .cw-form textarea, .cw-form select,
.cw-card input, .cw-card textarea, .cw-card select, .cw-login input {
    width: 100%; min-height: var(--cw-tap); padding: 12px 14px;
    border: 1px solid #c4ccdb; border-radius: 10px; font: inherit;
    background: #fff; color: inherit;
}
.cw-form textarea, .cw-card textarea { min-height: 120px; }
.cw-form input[type="file"] { padding: 10px; }
.cw-check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.cw-check input { width: auto; min-height: 24px; height: 24px; width: 24px; }
.cw-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cw-row2 > span { display: block; }

button, .button {
    cursor: pointer; min-height: var(--cw-tap); padding: 12px 20px;
    border-radius: 10px; border: 1px solid #c4ccdb; background: #fff;
    font: inherit; text-decoration: none; color: var(--cw-ink);
    display: inline-flex; align-items: center; justify-content: center;
}
button.primary { background: var(--cw-accent); border-color: var(--cw-accent); color: #fff; font-weight: 700; }
.cw-save { width: 100%; font-size: 1.05rem; }

.cw-after { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.cw-after .inline { display: block; }
.cw-view { width: 100%; font-weight: 600; }
.cw-undo { width: 100%; color: var(--cw-muted); }

.thumb { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.cw-photo .thumb { max-height: 200px; width: auto; }
.cw-upload button { width: 100%; margin-top: 10px; }

/* ---- prijava ---- */
.cw-login { margin: 24px auto; max-width: 420px; }
.cw-login h1 { font-size: 1.35rem; margin: 0 0 4px; word-break: break-word; }
.cw-magic button { width: 100%; margin-top: 12px; }
.cw-alt { margin-top: 18px; border-top: 1px solid var(--cw-line); padding-top: 10px; }
.cw-alt summary { min-height: var(--cw-tap); display: flex; align-items: center;
                  cursor: pointer; color: var(--cw-muted); }
.cw-alt button { width: 100%; margin-top: 12px; }

/* ---- traka "Pregled kao" ---- */
.cw-imp-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #7a4b00; color: #fff; padding: 8px 16px; font-size: .95rem;
}
.cw-imp-exit { background: #fff; color: #7a4b00; border: none; font-weight: 700;
               padding: 10px 16px; min-height: var(--cw-tap); }

/* ---- stari "napredni" ekran (edit.html) ---- */
.versions { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.versions th, .versions td { text-align: left; padding: 8px; border-bottom: 1px solid #eef1f6; font-size: .9rem; }
.price-row, .repeat-row { border-top: 1px dashed #e2e7f0; padding-top: 10px; margin-top: 10px; }
.gallery-edit { display: grid; grid-template-columns: 1fr; gap: 12px; }
.gallery-item { display: flex; flex-direction: column; gap: 6px; }
label.toggle { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.toggle input { width: auto; min-height: 24px; }
.cw-actions { display: flex; flex-direction: column; gap: 10px; }
.cw-actions h2, .cw-actions p { margin: 0 0 4px; }

/* ---- veci ekrani ---- */
@media (min-width: 600px) {
    .cw-tiles { grid-template-columns: 1fr 1fr; }
    .cw-save, .cw-view, .cw-undo { width: auto; }
    .cw-after { flex-direction: row; align-items: center; }
    .cw-after .inline { display: inline-block; }
    .price-row { display: grid; grid-template-columns: 2fr 1fr 90px 2fr; gap: 8px; }
    .gallery-edit { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .cw-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
}
