:root {
    --bg: #161414;
    --surface: #252220;
    --surface2: #332f2e;
    --border: #4a4543;
    --text: #f5f2f1;
    --text-muted: #a8a4a2;
    --primary: #e31e24;
    --primary-hover: #c41920;
    --primary-dark: #8b1e21;
    --brand-grey: #5e5e5e;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }
.error { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; }

/* Login */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #161414 0%, #2a1818 50%, #332f2e 100%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.logo { text-align: center; margin-bottom: 2rem; }
.login-brand-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 1rem;
}
.logo h1 { font-size: 1.25rem; margin-top: 0.5rem; }
.subtitle { color: var(--text-muted); font-size: 0.875rem; }

.login-card label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.login-card input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

/* App layout */
#app-screen { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
}

.sidebar-header h2 { font-size: 1.1rem; margin-top: 0.75rem; }
.sidebar-brand-title {
    font-size: 0.95rem;
    text-align: center;
    margin: 0.35rem 0 0.5rem;
    line-height: 1.3;
    color: var(--text-muted);
}
.sidebar-brand-logo,
.sidebar-tenant-logo {
    display: block;
    max-width: 100%;
    max-height: 72px;
    width: auto;
    object-fit: contain;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    box-sizing: border-box;
}
.tenant-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
}
.tenant-banner-logo {
    max-width: 120px;
    max-height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}
.user-badge {
    display: inline-block;
    background: var(--surface2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.nav-menu { list-style: none; margin: 1.5rem 0; flex: 1; }
.nav-link {
    display: block;
    padding: 0.625rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.nav-link:hover, .nav-link.active {
    background: var(--surface2);
    color: var(--text);
}
.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 2px 8px rgba(227, 30, 36, 0.25);
}

.content { flex: 1; padding: 2rem; overflow-y: auto; }
.content h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.content h3 { font-size: 1rem; margin-bottom: 1rem; }

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: white; width: 100%; margin-top: 1.25rem; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); margin-left: 0.5rem; }
.btn-danger { background: #991b1b; color: white; padding: 0.25rem 0.5rem; font-size: 0.85rem; border: none; border-radius: 6px; cursor: pointer; }
.btn-danger:hover { background: #7f1d1d; }
.btn-action { padding: 0.25rem 0.5rem; font-size: 0.85rem; width: auto; margin: 0 0.15rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; grid-column: 1 / -1; }
.checkbox-inline { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.form-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.75rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); width: 100%; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: inset 0 1px 0 rgba(227, 30, 36, 0.06);
}
.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.stat-value { display: block; font-size: 1.75rem; font-weight: 600; margin-top: 0.25rem; color: var(--text); }

.info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.info-box ul { margin-top: 0.75rem; padding-left: 1.25rem; }
.info-box li { margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* Cards & forms */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-row { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
.phone-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 200px;
}
.phone-country-select {
    min-width: 9.5rem;
    max-width: 11rem;
    padding: 0.5rem 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
}
.phone-input-row input[type="tel"] {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}
.phone-field-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    min-width: 3.5rem;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.customer-form-grid > div { min-width: 0; }
.customer-form-grid label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.customer-form-grid input[type="text"],
.customer-form-grid input[type="email"],
.customer-form-grid input[type="datetime-local"],
.customer-form-grid textarea,
.customer-form-grid select { width: 100%; min-width: 0; box-sizing: border-box; }
.field-span-2 { grid-column: span 2; }
.guest-account-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.guest-account-grid .ga-field-wide { grid-column: span 2; min-width: 0; }
.logo-upload-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cust-logo-preview { max-width: 120px; max-height: 48px; object-fit: contain; background: var(--bg); padding: 4px; border-radius: 6px; }
.cust-logo-thumb { max-width: 48px; max-height: 32px; object-fit: contain; vertical-align: middle; }

input, select {
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
}

.toolbar { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.toolbar .btn-primary, .toolbar .btn-secondary { width: auto; margin-top: 0; }
.log-status { font-size: 0.9rem; color: var(--text-muted); margin: -0.5rem 0 1rem; min-height: 1.25rem; }
.log-status.error { color: var(--danger); }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-top: 2px solid var(--primary);
}
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th {
    background: linear-gradient(180deg, rgba(227, 30, 36, 0.12) 0%, var(--surface2) 100%);
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    border-bottom: 2px solid rgba(227, 30, 36, 0.35);
}
td { padding: 0.5rem 0.75rem; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(227, 30, 36, 0.06); }

.report-form .btn-primary { width: auto; margin-top: 0; }

#kvkk-inventory .inv-item {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}
#kvkk-inventory .inv-item:last-child { border: none; }
#kvkk-inventory strong { color: var(--primary); }

@media (max-width: 768px) {
    #app-screen { flex-direction: column; }
    .sidebar { width: 100%; }
}
