:root {
    --ud-bg: #f3f4f6;
    --ud-panel-bg: #ffffff;
    --ud-border: #e5e7eb;
    --ud-text: #111827;
    --ud-muted: #6b7280;
    --ud-primary: #2563eb;    /* blue */
    --ud-primary-hover: #1d4ed8;
    --ud-danger: #dc2626;
    --ud-danger-hover: #b91c1c;
    --ud-edit: #f97316;       /* orange */
    --ud-edit-hover: #ea580c;
    --ud-radius-xl: 1.25rem;
    --ud-radius-lg: 0.75rem;
    --ud-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --ud-shadow-subtle: 0 4px 12px rgba(15, 23, 42, 0.06);
    --ud-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

/* Reset & base */

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

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #e5f0ff 0, #f3f4f6 45%, #e5e7eb 100%);
    color: var(--ud-text);
}

/* Shell layout (for dashboard / branding) */
.ud-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ud-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
    background: linear-gradient(
        to right,
        rgba(15, 23, 42, 0.96),
        rgba(30, 64, 175, 0.92)
    );
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.ud-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ud-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: #e5e7eb;
}

.ud-header-title h1 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ud-header-title span {
    font-size: 0.8rem;
    opacity: 0.85;
}

.ud-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #e5e7eb;
}

.ud-header-user strong {
    font-weight: 600;
}

.ud-main {
    flex: 1;
    padding: 1.75rem 1rem 2.5rem;
}

.ud-main-inner {
    max-width: 1120px;
    margin: 0 auto;
}

/* Floating panel */
.ud-panel {
    background: radial-gradient(circle at top left, #eef2ff 0, #ffffff 60%);
    border-radius: var(--ud-radius-xl);
    box-shadow: var(--ud-shadow-soft);
    padding: 1.5rem 1.75rem 1.75rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.ud-panel + .ud-panel {
    margin-top: 1.5rem;
}

.ud-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.ud-panel-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ud-panel-header-title h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ud-panel-header-title p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ud-muted);
}

.ud-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ud-panel-center {
    max-width: 640px;
    margin: 0 auto;
    text-align: left;
}

/* Typography helpers */
.ud-text {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.ud-text-muted {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--ud-muted);
}

.ud-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    font-size: 0.95rem;
}

.ud-list li + li {
    margin-top: 0.35rem;
}

/* Pills */
.ud-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ud-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.55);
    color: #0f172a;
}

.ud-pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Buttons */
.btn,
.ud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
        border-color 0.15s ease, transform 0.08s ease;
}

.btn:focus-visible,
.ud-btn:focus-visible {
    outline: none;
    box-shadow: var(--ud-focus-ring);
}

.btn-primary,
.ud-btn-primary {
    background: var(--ud-primary);
    color: #f9fafb;
    border: 1px solid transparent;
}

.btn-primary:hover,
.ud-btn-primary:hover {
    background: var(--ud-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--ud-shadow-subtle);
}

.btn-edit,
.ud-btn-edit {
    background: var(--ud-edit);
    color: #111827;
}

.btn-edit:hover,
.ud-btn-edit:hover {
    background: var(--ud-edit-hover);
}

.btn-danger,
.ud-btn-danger {
    background: var(--ud-danger);
    color: #fef2f2;
}

.btn-danger:hover,
.ud-btn-danger:hover {
    background: var(--ud-danger-hover);
}

.btn-ghost,
.ud-btn-ghost {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn-ghost:hover,
.ud-btn-ghost:hover {
    background: rgba(15, 23, 42, 0.12);
}

/* Links */
a {
    color: var(--ud-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Forms */
.ud-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ud-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .ud-form-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.ud-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ud-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.ud-label span {
    font-weight: 400;
    color: var(--ud-muted);
    font-size: 0.85rem;
}

.ud-input,
.ud-textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border-radius: 0.75rem;
    border: 1px solid var(--ud-border);
    font-size: 0.9rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.ud-input:focus-visible,
.ud-textarea:focus-visible {
    outline: none;
    border-color: var(--ud-primary);
    box-shadow: var(--ud-focus-ring);
    background: #ffffff;
}

.ud-textarea {
    min-height: 80px;
    resize: vertical;
}

.ud-help {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ud-muted);
}

/* Form layout helpers */
.ud-form-actions {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.ud-form-actions-left {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* Admin layout (used by /admin pages) */

.ud-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, #e5f0ff 0, #f3f4f6 45%, #e5e7eb 100%);
}

.ud-admin-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.6);
}

.ud-admin-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.ud-admin-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e5e7eb;
}

.ud-admin-logo-circle {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #fde68a 0, #f97316 35%, #dc2626 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.7);
}

.ud-admin-logo-text {
    font-weight: 800;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.ud-admin-brand-text h1 {
    margin: 0;
    font-size: 1rem;
}

.ud-admin-brand-text p {
    margin: 0;
    font-size: 0.78rem;
    opacity: 0.85;
}

.ud-admin-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    color: #e5e7eb;
    font-size: 0.8rem;
}

.ud-admin-user-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ud-admin-user-row strong {
    font-weight: 600;
}

.ud-admin-nav {
    border-top: 1px solid rgba(148, 163, 184, 0.6);
    background: radial-gradient(circle at top, #020617 0, #0f172a 40%, #020617 100%);
}

.ud-admin-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.4rem 1.5rem 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ud-admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    text-decoration: none;
    color: #e5e7eb;
    background: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease,
        color 0.15s ease, transform 0.08s ease;
}

.ud-admin-nav-link:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(148, 163, 184, 0.7);
    transform: translateY(-1px);
}

.ud-admin-nav-link-active {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.ud-admin-nav-link-outline {
    border-color: rgba(148, 163, 184, 0.8);
    background: transparent;
    color: #e5e7eb;
}

/* Admin main content */

.ud-admin-main {
    flex: 1;
    padding: 1.75rem 1rem 2.5rem;
}

.ud-admin-main-inner {
    max-width: 1120px;
    margin: 0 auto;
}

/* Simple tables */
.ud-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ud-table th,
.ud-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.ud-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ud-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ud-table tbody tr:hover {
    background: rgba(239, 246, 255, 0.7);
}

/* Badges */
.ud-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(249, 250, 251, 0.95);
}

.ud-badge-success {
    border-color: rgba(22, 163, 74, 0.8);
    color: #166534;
    background: rgba(220, 252, 231, 0.95);
}

.ud-badge-danger {
    border-color: rgba(220, 38, 38, 0.8);
    color: #b91c1c;
    background: rgba(254, 226, 226, 0.95);
}

/* Admin footer */
.ud-admin-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.5);
    background: #020617;
    color: #e5e7eb;
}

.ud-admin-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.ud-admin-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ud-admin-footer-nav a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.78rem;
    opacity: 0.9;
}

.ud-admin-footer-nav a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* AUTH PAGES HELPERS (bottom of app shell) */

/* App-level header/footer (Shop-Core shell) */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--ud-panel-bg);
    border-bottom: 1px solid var(--ud-border);
    box-shadow: var(--ud-shadow-subtle);
}

.app-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: var(--ud-shadow-soft);
}

.brand-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: linear-gradient(135deg, var(--ud-primary), #0f172a);
    color: #e5e7eb;
    box-shadow: var(--ud-shadow-soft);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.brand-title {
    font-weight: 600;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--ud-muted);
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-nav-link {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--ud-muted);
    border: 1px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-nav-link:hover {
    color: var(--ud-text);
    background-color: #e5edff;
    border-color: rgba(148, 163, 184, 0.6);
}

.app-header-user {
    font-size: 0.85rem;
    color: var(--ud-muted);
}

.app-header-custom {
    border-top: 1px solid var(--ud-border);
    background: #f9fafb;
}

.app-footer {
    margin-top: auto;
    border-top: 1px solid var(--ud-border);
    background: rgba(249, 250, 251, 0.9);
    backdrop-filter: blur(8px);
}

.app-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    color: var(--ud-muted);
}

/* Generic app shell for pages that include app-header/footer */
.app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1 0 auto;
}

.app-main-inner {
    max-width: 1120px;
    margin: 1.75rem auto 2.5rem;
    padding: 0 1.5rem;
}

.ud-tab-bar { border-color: #ddd; }
.ud-tab {
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    background: #f6f6f6;
    color: #333;
    text-decoration: none;
}
.ud-tab:hover { background: #e9e9e9; }

.ud-tab-active {
    background: white;
    border: 1px solid #ddd;
    border-bottom: none;
    font-weight: 600;
}

.ud-white-panel {
    background: white;
    border-radius: 20px;
    padding: 24px;
}

