@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #fdf6f0;
    --card: #fffaf7;
    --text: #1c1c1c;
    --muted: #5f5a56;
    --line: #dccfc3;
    --accent: #8b1e1e;
    --accent-dark: #6f1717;
    --danger: #8b1e1e;
    --gold: #bfa18c;
    --shadow: 0 8px 28px rgba(28, 28, 28, 0.08);
}

* {
    box-sizing: border-box;
}

img, video {
    max-width: 100%;
    height: auto;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at 8% 2%, rgba(191, 161, 140, 0.18), transparent 38%),
        linear-gradient(180deg, #fef9f4 0%, var(--bg) 24%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: min(1200px, 92vw);
    margin: 0 auto;
}

.topbar {
    background: rgba(253, 246, 240, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    gap: 1rem;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    object-fit: contain;
    box-shadow: 0 1px 4px rgba(28,28,28,0.10);
    padding: 2px;
}

.brand-text-wrap {
    display: inline-flex;
    flex-direction: column;
}

.brand-text {
    color: var(--text);
}

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

.nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--accent);
}

.nav-portal-link {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent) !important;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.nav-portal-link:hover {
    background: var(--accent);
    color: #fff !important;
}

.page {
    padding: 3rem 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 110px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding-right: 1.5rem;
}

.sidebar-label {
    margin: 0 0 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-nav {
    display: grid;
    gap: 0.5rem;
}

.sidebar-link {
    text-decoration: none;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: var(--text);
    background: #f4ebe4;
}

.sidebar-link.active {
    color: #fff7f2;
    background: var(--text);
    border-left: 3px solid var(--accent);
}

.content-area {
    min-width: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: 0;
}

.hero h1,
.card h1,
.card h2,
.card h3 {
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card h1 { font-size: 2rem; }
.card h2 { font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.card h3 { font-size: 1.25rem; }

.muted {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat.card {
    padding: 2rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--text);
    box-shadow: 4px 4px 0px 0px var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat.card:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px var(--text);
}

.stat h3 {
    margin: 0 0 0.5rem 0;
    font-size: 3rem;
    color: var(--text);
    font-weight: 400;
}

.stat p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.actions-row {
    display: flex;
    gap: 0.75rem;
}

.badge {
    display: inline-block;
    border: 1px solid var(--text);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-good {
    background: var(--text);
    color: var(--bg);
}

.badge-neutral {
    background: var(--bg);
    color: var(--text);
}

.btn,
button,
input,
select,
textarea {
    font: inherit;
    border-radius: 0;
}

.btn,
button {
    border: 1px solid var(--text);
    background: var(--bg);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover,
button:hover {
    background: #f4ebe4;
}

.btn-primary {
    background: var(--accent);
    color: #fff7f2;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: #fff7f2;
}

.btn-danger {
    border-color: var(--text);
    color: var(--text);
}

.btn-danger:hover {
    background: var(--text);
    color: var(--bg);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.field span {
    font-weight: 500;
    font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--line);
    padding: 0.75rem;
    background: var(--bg);
    transition: border-color 0.2s;
}

.field gmp-place-autocomplete {
    width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 30, 30, 0.12);
}

.location-tools {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.location-tools .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
}

.full {
    grid-column: 1 / -1;
}

.alert {
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff7f2;
}

.alert-error {
    background: var(--bg);
    color: var(--text);
    border-style: dashed;
}

.user-pill {
    border: 1px solid var(--text);
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.inline-form {
    display: inline;
}

.link-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover {
    background: transparent;
    color: var(--accent);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    width: 100%;
    padding-right: 5.9rem;
    border-radius: 0.6rem;
    background: #fff;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    min-width: 5rem;
    height: 2rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 0.55rem;
    background: #fff;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(28, 28, 28, 0.08);
}

.pw-toggle .pw-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pw-toggle .pw-icon-hide {
    display: none;
}

.pw-toggle.is-revealed .pw-icon-show {
    display: none;
}

.pw-toggle.is-revealed .pw-icon-hide {
    display: inline-flex;
}

.pw-toggle svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pw-toggle:hover,
.pw-toggle:focus-visible {
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 30, 30, 0.14);
}

.auth-card {
    max-width: 520px;
    margin: 4rem auto;
    border: 1px solid var(--text);
    box-shadow: 10px 10px 0px 0px rgba(28, 28, 28, 0.85);
    background: linear-gradient(180deg, #fffdfb 0%, #fff7f1 100%);
    padding: 2.2rem;
}

.auth-card .field span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-card .btn-primary {
    min-height: 2.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 480px) {
    .password-wrap input {
        padding-right: 4.95rem;
    }

    .pw-toggle {
        min-width: 4.2rem;
        font-size: 0.66rem;
        padding: 0 0.42rem;
    }
}

.role-hero {
    background: var(--text);
    color: var(--bg);
    border: none;
}

.role-hero h1 {
    color: var(--bg);
}

.role-hero .muted {
    color: #a0a0a0;
}

/* ── Image Gallery ──────────────────────────────────────────────────────── */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.image-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.image-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    background: #f4f4f4;
    display: block;
}

.image-card form {
    margin: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.image-card .order-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9em;
    font-weight: 500;
}

.image-card .order-input {
    width: 70px;
    padding: 0.35rem 0.5rem;
}

.image-card .caption-input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
}

.image-meta {
    font-size: 0.85em;
    margin: auto 0 0 0;
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }

    .sidebar-nav {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 760px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        min-height: 64px;
        flex-direction: column;
        padding: 1rem 0;
        gap: 1rem;
    }
}

/* ── Management-portal additions ────────────────────────────────────────── */

.badge-warning {
    background: var(--text);
    color: var(--bg);
    border-style: dashed;
}

.badge-danger {
    background: var(--text);
    color: var(--bg);
}

.badge-info {
    background: var(--bg);
    color: var(--muted);
    border-color: var(--muted);
}

.sc-brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-top: -2px;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.search-bar input,
.search-bar select {
    border: 1px solid var(--line);
    padding: 0.6rem 0.75rem;
    font: inherit;
    background: var(--bg);
    min-width: 180px;
}

.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--text);
}

.data-table th:first-child,
.data-table td:first-child {
    width: 60px;
    color: var(--muted);
}

.audit-action {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.meta-info {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-item span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    display: block;
    margin-bottom: 0.25rem;
}

.detail-item strong {
    font-weight: 500;
}

.action-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 2rem;
}

.pagination a {
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--line);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.pagination a:hover {
    background: #f4ebe4;
}

.pagination .current {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.inline-select {
    border: 1px solid var(--line);
    padding: 0.5rem 0.75rem;
    font: inherit;
    background: var(--bg);
}
