:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

nav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

nav .nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

nav .nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

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

main {
    padding: 32px 0;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

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

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

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

td {
    font-size: 0.9rem;
}

tr:hover td {
    background: var(--bg);
}

.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}

/* Landing page */
.hero {
    text-align: center;
    padding: 60px 0 40px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature {
    text-align: left;
}

.feature h3 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.feature p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 24px;
}

.auth-container .switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-container .switch a {
    color: var(--primary);
}

/* Dashboard */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-header h1 {
    font-size: 1.5rem;
}

.uuid-name {
    font-weight: 500;
}

.uuid-id {
    color: var(--text-muted);
}

/* Detail page */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.detail-header h1 {
    font-size: 1.3rem;
    word-break: break-all;
}

.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-container img {
    max-width: 256px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    .form-row {
        flex-direction: column;
    }
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
