:root {
    --brand: #3300ff;
    --brand-dark: #2200cc;
    --text-dark: #1a1a1a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg-body: #ffffff;
    --bg-panel: #ffffff;
    --bg-field: #f3f4f6;
    --bg-sidebar-active: #f1f0ff;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    font-size: 14px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Layout ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 16px;
}

.sidebar-top .logo { display: block; margin-bottom: 24px; }
.sidebar-top .logo img { height: 28px; }

.nav-menu { list-style: none; margin: 0; padding: 0; }
.nav-menu li { margin-bottom: 4px; }
.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}
.nav-menu a:hover { background: var(--bg-sidebar-active); text-decoration: none; }
.nav-menu a.active { background: var(--bg-sidebar-active); color: var(--brand); }
.nav-menu .icon-box {
    width: 22px; height: 22px;
    border: 1.5px solid #c9c9d6;
    border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 14px;
}

.sidebar-bottom { padding-top: 16px; border-top: 1px solid var(--border); }
.powered-by { font-size: 11px; color: var(--text-muted); text-align: left; }
.powered-by img { height: 24px; display: block; margin-top: 6px; }

/* ---------------- Main content ---------------- */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
}
.breadcrumb { color: var(--text-muted); font-size: 14px; }
.breadcrumb strong { color: var(--text-dark); }
.breadcrumb .sep { margin: 0 6px; color: #c4c4cf; }

.btn-logout {
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    color: var(--text-dark);
}
.btn-logout:hover { background: var(--bg-field); }

.page-body { padding: 24px 32px 48px; flex: 1; }
.page-title { font-size: 24px; font-weight: 700; margin: 8px 0 20px; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs a {
    padding: 10px 2px 14px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }

/* ---------------- Panels / Cards ---------------- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}
.panel h3 { margin: 0 0 16px; font-size: 16px; font-weight: 700; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg-field);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    width: 100%;
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--brand); background: #fff; }

.form-actions { display: flex; gap: 12px; margin-top: 24px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text-dark); }
.btn-secondary:hover { background: var(--bg-field); text-decoration: none; }
.btn-danger { background: #fff; border-color: #f3c9c9; color: #c0392b; }
.btn-danger:hover { background: #fdecec; text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------------- Table ---------------- */
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
    color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 12px;
}
table.data-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:hover { background: #fafafa; }
.actions-cell { display: flex; gap: 14px; }

.search-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.search-bar input {
    background: var(--bg-field); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 14px; width: 280px; font-size: 14px;
}

.empty-state {
    background: var(--bg-field); border-radius: var(--radius);
    text-align: center; padding: 40px; color: var(--text-muted);
}

/* ---------------- Photos tab ---------------- */
.image-grid { display: flex; flex-wrap: wrap; gap: 20px; }
.image-card {
    width: 184px; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
    text-align: center;
}
.image-card .thumb {
    width: 100%; height: 150px; border-radius: 6px; background: var(--bg-field);
    display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 10px;
}
.image-card .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-card .links { display: flex; justify-content: center; gap: 12px; font-size: 13px; font-weight: 600; }
.image-card .links a.delete { color: #c0392b; }
.upload-box {
    border: 1.5px dashed var(--border); border-radius: 10px; padding: 24px; text-align: center;
    color: var(--text-muted); margin-bottom: 20px;
}
.upload-box input[type=file] { margin-top: 10px; }

/* ---------------- Login ---------------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #fafafa;
}
.login-card {
    width: 380px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 36px;
}
.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo img { height: 34px; }
.login-card h2 { text-align: center; font-size: 18px; margin: 0 0 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }
.login-error {
    background: #fdecec; color: #c0392b; border: 1px solid #f3c9c9; border-radius: var(--radius);
    padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.login-success {
    background: #eafaf1; color: #1e8449; border: 1px solid #c8f0d8; border-radius: var(--radius);
    padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.login-links { text-align: center; margin-top: 16px; font-size: 13px; }

/* ---------------- Product list (card rows) ---------------- */
.list-search-form {
    position: relative;
    margin-bottom: 24px;
}
.list-search-form .search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted);
    display: flex;
}
.list-search-form input {
    width: 100%;
    background: var(--bg-field);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px 12px 44px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
}
.list-search-form input:focus { outline: none; border-color: var(--brand); background: #fff; }

.list-meta-bar {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.results-count { font-size: 14px; color: var(--text-dark); }
.results-count .highlight { color: #e63946; font-weight: 600; }
.btn-add { display: inline-flex; align-items: center; gap: 6px; }

.product-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }

.product-row {
    display: flex; align-items: center; gap: 20px;
    border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px;
}
.product-thumb {
    width: 76px; height: 76px; flex-shrink: 0;
    background: var(--bg-field); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-thumb .no-image { font-size: 11px; color: var(--text-muted); text-align: center; padding: 0 6px; }

.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.product-name a { color: var(--text-dark); text-decoration: none; }
.product-name a:hover { color: var(--brand); text-decoration: none; }
.product-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 13px; color: var(--text-muted); }
.product-meta strong { color: var(--text-dark); font-weight: 600; }

.product-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.icon-btn {
    width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-field); text-decoration: none; color: var(--text-dark); }
.icon-btn-danger:hover { background: #fdecec; color: #c0392b; border-color: #f3c9c9; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 8px; }
.page-indicator { font-size: 13px; color: var(--text-muted); }
.btn-disabled { opacity: .45; pointer-events: none; }

/* ---------------- Read-only view fields ---------------- */
.view-field {
    background: var(--bg-field); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; font-size: 14px; min-height: 20px;
}
.view-field .muted { color: var(--text-muted); }

/* ---------------- Misc ---------------- */
.version-tag { font-size: 12px; color: var(--text-muted); }
.footer-strip {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 32px; border-top: 1px solid var(--border);
}
.flash-banner {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; font-weight: 500;
}
.flash-success { background: #eafaf1; color: #1e8449; border: 1px solid #c8f0d8; }
.flash-error { background: #fdecec; color: #c0392b; border: 1px solid #f3c9c9; }

.copy-btn {
    background: none; border: none; cursor: pointer; color: var(--text-muted); float: right; margin-top: -30px; margin-right: 6px;
}
