/* Onesta Admin — clean, light, friendly UI.
   Visual language: soft blue gradient background, floating white app panel,
   airy sidebar, line icons, gentle shadows, generous spacing, light pill badges. */

:root {
    --bg-grad-top:    #d8e6f7;
    --bg-grad-bottom: #eef3fa;
    --panel-bg:       #ffffff;
    --panel-shadow:   0 10px 30px rgba(80, 100, 140, 0.10);
    --sidebar-bg:     #f7f9fc;
    --border:         #e8ecf1;
    --border-strong:  #d4dae3;
    --text:           #1e2330;
    --text-dim:       #6b7280;
    --text-muted:     #9aa3b2;
    --accent:         #4870ff;
    --accent-soft:    #eef2ff;
    --danger:         #d92d20;
    --danger-soft:    #fee4e2;
    --success:        #039855;
    --success-soft:   #d1fadf;
    --warn:           #b54708;
    --warn-soft:      #fef0c7;
    --radius-lg:      16px;
    --radius-md:      10px;
    --radius-sm:      6px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg-grad-bottom) 60%, var(--bg-grad-bottom) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-dim); }
hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* ===== Login page ===== */
html, body.login-page { height: 100%; margin: 0; }
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--panel-shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
}
.login-title {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.login-subtitle { margin: 0 0 28px; color: var(--text-dim); font-size: 14px; }
.login-error {
    background: var(--danger-soft); border: 1px solid #fecdca;
    color: var(--danger);
    padding: 10px 12px; border-radius: var(--radius-sm);
    margin-bottom: 16px; font-size: 13px;
}
.login-card label {
    display: block; margin: 14px 0 6px;
    font-weight: 500; font-size: 13px; color: var(--text);
}
.login-card input[type=text],
.login-card input[type=password] {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: #fff;
    color: var(--text);
    transition: border-color 120ms, box-shadow 120ms;
}
.login-card input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(72, 112, 255, 0.15);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: #fff; color: var(--text);
    font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
    text-decoration: none;
    transition: background 120ms, border-color 120ms;
}
.btn:hover { background: var(--sidebar-bg); border-color: var(--text-muted); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--text); color: #fff; border-color: var(--text);
}
.btn-primary:hover { background: #000; border-color: #000; }
.btn-primary:disabled { background: var(--text-muted); border-color: var(--text-muted); }
.btn-danger {
    background: var(--danger-soft); color: var(--danger); border-color: transparent;
}
.btn-danger:hover { background: #fecdca; }
.btn-link {
    background: transparent; padding: 4px 6px;
    color: var(--accent); border-color: transparent;
}
.btn-link:hover { background: var(--accent-soft); }
.btn-primary.login-submit {
    margin-top: 24px; width: 100%; justify-content: center;
    padding: 12px 16px;
}

/* ===== Admin shell ===== */
.admin-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg-grad-bottom) 60%, var(--bg-grad-bottom) 100%);
}

.admin-frame {
    background: var(--panel-bg);
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    width: 100%;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand {
    color: var(--text); font-weight: 700; font-size: 16px;
    display: inline-flex; align-items: center; gap: 8px;
}
.topbar-brand::before {
    content: ""; display: inline-block; width: 22px; height: 22px;
    background: var(--text); border-radius: 6px;
    background-image:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9) 0%, transparent 30%),
        radial-gradient(circle at 70% 70%, rgba(255,255,255,0.5) 0%, transparent 35%);
}
.topbar-brand:hover { text-decoration: none; }
.topbar-actions { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.topbar-user {
    color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 8px;
}
.topbar-user::before {
    content: ""; display: inline-block; width: 28px; height: 28px;
    background: linear-gradient(135deg, #c8d8ff, #ffd8e5); border-radius: 50%;
    border: 1px solid #fff;
}
.topbar-logout {
    color: var(--text-dim); padding: 6px 10px;
    border-radius: var(--radius-sm); transition: background 120ms;
}
.topbar-logout:hover { background: var(--sidebar-bg); text-decoration: none; color: var(--text); }

.admin-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 65px); /* topbar height */
}

.admin-credit {
    position: fixed;
    right: 18px;
    bottom: 10px;
    font-size: 11px;
    color: var(--text-dim);
    opacity: 0.55;
    letter-spacing: 0.02em;
    pointer-events: none;
    z-index: 5;
}

/* Tablet: sidebar narrower */
@media (max-width: 1024px) {
    .admin-body { grid-template-columns: 200px 1fr; }
}

/* Mobile: sidebar collapses below topbar */
@media (max-width: 720px) {
    .admin-body { grid-template-columns: 1fr; }
    .sidebar {
        border-right: none; border-bottom: 1px solid var(--border);
        padding: 8px;
    }
    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
    }
    .sidebar a {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .sidebar hr { display: none; }
    .topbar { padding: 12px 16px; }
    .content-area { padding: 20px 16px 100px; }
    .page-header h1 { font-size: 22px; }
    .field-bilingual { grid-template-columns: 1fr; }
}

/* ===== Sidebar ===== */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; color: var(--text-dim);
    font-size: 13px; font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background 120ms, color 120ms;
}
.sidebar a:hover { background: #fff; color: var(--text); text-decoration: none; }
.sidebar a.active {
    background: #fff; color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.sidebar a::before {
    content: ""; width: 16px; height: 16px;
    background-color: currentColor;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    opacity: 0.7;
}
/* SVG icons via mask, inline data URIs */
.sidebar a[href="/dashboard"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><polyline points='9 22 9 12 15 12 15 22'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><polyline points='9 22 9 12 15 12 15 22'/></svg>"); }
.sidebar a[href="/homepage"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M3 9h18M9 21V9'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M3 9h18M9 21V9'/></svg>"); }
.sidebar a[href="/about"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4M12 8h.01'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4M12 8h.01'/></svg>"); }
.sidebar a[href="/services"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/></svg>"); }
.sidebar a[href="/brands"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"); }
.sidebar a[href="/machines"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 8h1a4 4 0 0 1 0 8h-1'/><path d='M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4z'/><line x1='6' y1='1' x2='6' y2='4'/><line x1='10' y1='1' x2='10' y2='4'/><line x1='14' y1='1' x2='14' y2='4'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 8h1a4 4 0 0 1 0 8h-1'/><path d='M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4z'/><line x1='6' y1='1' x2='6' y2='4'/><line x1='10' y1='1' x2='10' y2='4'/><line x1='14' y1='1' x2='14' y2='4'/></svg>"); }
.sidebar a[href="/footer"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><line x1='3' y1='15' x2='21' y2='15'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><line x1='3' y1='15' x2='21' y2='15'/></svg>"); }
.sidebar a[href="/settings"]::before { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/></svg>"); }

.content-area {
    padding: 32px 40px 120px;
    overflow-x: hidden;
}
/* Cap form/text content so it doesn't sprawl on ultrawide screens */
.content-area > * { max-width: 1100px; }
.content-area > .card-grid,
.content-area > .item-list { max-width: 1400px; }

/* ===== Pages ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 {
    margin: 0 0 6px;
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.page-header p { margin: 0; color: var(--text-dim); font-size: 14px; }

.page-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    margin-bottom: 18px;
}
.page-section h2 {
    font-size: 15px; font-weight: 600;
    margin: 0 0 18px;
    color: var(--text);
    letter-spacing: -0.005em;
}
.page-subsection {
    background: var(--sidebar-bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 14px;
}
.page-subsection:last-child { margin-bottom: 0; }
.page-subsection h3 {
    font-size: 12px; font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ===== Dashboard home ===== */
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.card {
    display: block; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 20px;
    color: var(--text);
    transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}
.card:hover {
    text-decoration: none;
    border-color: var(--border-strong);
    box-shadow: 0 4px 12px rgba(80, 100, 140, 0.08);
    transform: translateY(-1px);
}
.card h2 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.card p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.5; }

/* ===== Form fields ===== */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label {
    display: block;
    font-weight: 500; font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=number],
.field input[type=password],
.field textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
    transition: border-color 120ms, box-shadow 120ms;
}
.field input:focus, .field textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(72, 112, 255, 0.15);
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.field-bilingual {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.lang {
    position: relative;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--sidebar-bg);
    padding: 14px 12px 10px;
    cursor: text;
    transition: border-color 120ms, background 120ms;
}
.lang:hover { border-color: var(--border-strong); }
.lang:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08); }
.lang-tag {
    position: absolute; top: -8px; left: 10px;
    background: var(--text); color: #fff;
    font-size: 10px; padding: 2px 7px; border-radius: 3px;
    letter-spacing: 0.06em; font-weight: 600;
}
.lang input, .lang textarea {
    border: none; background: transparent;
    width: 100%; display: block;
    font-size: 14px; padding: 4px 0;
    min-height: 22px;
    box-sizing: border-box;
}
.lang input:focus, .lang textarea:focus {
    outline: none; background: transparent;
}
.lang-rtl input, .lang-rtl textarea { text-align: right; }

/* ===== Image field ===== */
.image-field .image-preview-wrap {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
    padding: 16px; background: var(--sidebar-bg);
}
.image-preview {
    max-width: 260px; max-height: 180px;
    min-width: 120px; min-height: 120px;
    object-fit: contain;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 4px;
}
.image-pick {
    display: inline-block; cursor: pointer;
    background: #fff;
}

/* ===== Save bar ===== */
.save-bar {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 8px 12px 8px 20px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 8px 30px rgba(80, 100, 140, 0.15);
    z-index: 20;
    max-width: calc(100% - 32px);
}
@media (max-width: 720px) {
    .save-bar {
        left: 16px; right: 16px;
        transform: none;
        justify-content: space-between;
    }
}
.save-indicator {
    font-size: 13px; color: var(--text-dim);
    padding-right: 6px;
}
.save-bar .btn { padding: 8px 16px; border-radius: 24px; }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 28px; left: 50%;
    transform: translate(-50%, -20px);
    background: var(--text); color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    opacity: 0; pointer-events: none;
    transition: all 0.22s ease;
    font-size: 13px; z-index: 100; max-width: 80vw;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }

/* ===== Item list (brand grid, machine grid) ===== */
.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.item-card {
    background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
    position: relative;
    transition: border-color 150ms, box-shadow 150ms, transform 150ms;
    color: var(--text);
}
.item-card:hover {
    text-decoration: none;
    border-color: var(--border-strong);
    box-shadow: 0 4px 12px rgba(80, 100, 140, 0.08);
    transform: translateY(-1px);
}
.item-card-img {
    width: 100%; height: 120px; object-fit: contain;
    background: var(--sidebar-bg);
    border-radius: var(--radius-sm);
    padding: 8px;
}
.item-card-title { font-weight: 600; font-size: 13px; color: var(--text); }
.item-card-subtitle { font-size: 12px; color: var(--text-dim); }
.item-card-actions {
    display: flex; gap: 6px; margin-top: auto;
}
.item-card-actions .btn { padding: 5px 10px; font-size: 12px; }

.add-card {
    display: flex; align-items: center; justify-content: center;
    background: var(--sidebar-bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 32px 12px;
    color: var(--text-dim);
    cursor: pointer;
    text-align: center;
    font-size: 13px; font-weight: 500;
    min-height: 200px;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.add-card:hover {
    background: #fff;
    color: var(--text);
    border-color: var(--accent);
}

/* ===== Capsule rows ===== */
.row-grid {
    display: grid; gap: 12px;
    grid-template-columns: 90px 1fr 1fr 110px 90px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 12px 14px; margin-bottom: 10px;
}
.row-grid.capsule { grid-template-columns: 24px 90px 1fr 110px 110px 32px; }
.row-grid.capsule .drag-handle { justify-self: center; }
.row-grid.capsule .cap-remove { justify-self: end; }
.row-grid input[type=text],
.row-grid input[type=number] { padding: 8px 10px; font-size: 13px; display: block; width: 100%; box-sizing: border-box; }
.row-grid img {
    width: 70px; height: 70px; object-fit: contain;
    background: var(--sidebar-bg);
    border-radius: var(--radius-sm); padding: 4px;
}

/* ===== Dialog ===== */
dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    max-width: 480px; width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
dialog::backdrop { background: rgba(30, 35, 48, 0.4); }
dialog form { padding: 28px; }
dialog h2 { margin: 0 0 18px; font-size: 18px; font-weight: 600; }

/* ===== Tables (Settings backups) ===== */
.settings-table {
    width: 100%; max-width: 700px;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden;
    font-size: 13px;
}
.settings-table th {
    background: var(--sidebar-bg);
    text-align: left; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim); font-weight: 500;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}
.settings-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.settings-table tr:last-child td { border-bottom: none; }

/* ===== Password input with toggle ===== */
.password-wrap {
    position: relative;
}
.password-wrap input { padding-right: 40px !important; }
.password-toggle {
    position: absolute;
    right: 4px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; cursor: pointer;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
}
.password-toggle:hover { background: var(--sidebar-bg); color: var(--text); }
.password-toggle::before {
    content: ""; width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/><circle cx='12' cy='12' r='3'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/><circle cx='12' cy='12' r='3'/></svg>") center / contain no-repeat;
}
.password-toggle.is-shown::before {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/><line x1='1' y1='1' x2='23' y2='23'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/><line x1='1' y1='1' x2='23' y2='23'/></svg>") center / contain no-repeat;
}

/* ===== Save bar hidden when no changes ===== */
.save-bar-hidden {
    opacity: 0; pointer-events: none;
    transform: translate(-50%, 20px);
    transition: opacity 200ms, transform 200ms;
}
.save-bar:not(.save-bar-hidden) {
    transition: opacity 200ms, transform 200ms;
}

.image-pick.disabled { opacity: 0.6; pointer-events: none; }

/* ===== Danger zone ===== */
.danger-zone {
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    background: #fef4f4;
    padding: 18px 22px;
    margin-top: 28px;
}
.danger-zone h2 {
    color: var(--danger); margin: 0 0 8px;
    font-size: 14px; font-weight: 600;
}
.danger-zone p { margin: 0 0 14px; font-size: 13px; color: var(--text); }

/* ===== List search input ===== */
.list-toolbar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 16px;
}
.search-input {
    flex: 1; max-width: 360px;
    padding: 9px 14px 9px 36px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
    background-size: 16px 16px;
    font-size: 13px; color: var(--text);
}
.search-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(72, 112, 255, 0.15);
}

/* ===== Incomplete badge on items ===== */
.item-card .incomplete-flag {
    position: absolute; top: 8px; right: 8px;
    background: var(--warn-soft); color: var(--warn);
    font-size: 10px; font-weight: 600;
    padding: 3px 8px; border-radius: 999px;
    letter-spacing: 0.03em;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--text-dim); background: var(--sidebar-bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
}
.empty-state h3 {
    margin: 0 0 6px; font-size: 14px; color: var(--text); font-weight: 600;
}
.empty-state p { margin: 0; font-size: 13px; }

/* ===== Gallery action buttons - cleaner ===== */
.gallery-actions {
    display: flex; gap: 4px; align-items: center;
}
.icon-btn {
    width: 28px; height: 28px; padding: 0;
    border-radius: var(--radius-sm);
    background: transparent; border: 1px solid transparent;
    color: var(--text-dim); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.icon-btn:hover { background: var(--sidebar-bg); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ===== Status badges (for future use) ===== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn); }
.badge-info    { background: var(--accent-soft);  color: var(--accent); }

/* ===== Danger confirmation modal ===== */
.danger-modal {
    border: none; border-radius: var(--radius);
    padding: 0; max-width: 480px; width: 90%;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.25);
    background: var(--bg);
}
.danger-modal::backdrop { background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px); }
.danger-modal form { padding: 24px; }
.danger-modal-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text); }
.danger-modal-message { margin: 0 0 20px; color: var(--text-dim); line-height: 1.5; font-size: 14px; }
.danger-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Drag-reorder states ===== */
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }
.is-dragging { opacity: 0.45; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* Drag handle (used inside dense rows like capsule list) */
.drag-handle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 28px;
    color: var(--text-dim); cursor: grab;
    font-size: 14px; line-height: 1; user-select: none;
    letter-spacing: -2px;
}
.drag-handle:hover { color: var(--text); }
.drag-handle:active { cursor: grabbing; }

/* ===== Drop-zone state on image fields ===== */
.image-field { transition: background-color 0.12s ease, outline-color 0.12s ease; outline: 1px dashed transparent; outline-offset: -4px; }
.image-field.drop-active { background: var(--accent-soft); outline-color: var(--accent); }

/* ===== Character counter ===== */
.char-counter {
    font-size: 11px; color: var(--text-dim);
    text-align: right; margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.char-counter.near-limit { color: var(--warn); }
.char-counter.over-limit { color: var(--danger); font-weight: 500; }

/* ===== Brand-detail gallery (Products) ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.gallery-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.gallery-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 2px;
}
.gallery-card-img {
    width: 100%; aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--sidebar-bg);
    border-radius: var(--radius-sm);
    padding: 8px;
}
.gallery-card-replace { text-align: center; font-size: 12px; padding: 6px 10px; }
.gallery-card input[type=text] {
    width: 100%; box-sizing: border-box;
    padding: 6px 10px; font-size: 13px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--sidebar-bg);
}
.gallery-card input[type=text]:focus {
    outline: none; border-color: var(--accent);
    background: #fff;
}
.gallery-add-btn {
    border: 2px dashed var(--border-strong); background: transparent;
    border-radius: var(--radius-md);
    padding: 32px 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px;
    color: var(--text-dim); cursor: pointer;
    transition: border-color 120ms, color 120ms, background 120ms;
    min-height: 220px;
}
.gallery-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
