* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f5f7;
    margin: 0;
    color: #1f2430;
}

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box {
    background: #fff; padding: 32px; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); width: 320px;
}
.login-box h1 { font-size: 20px; margin-bottom: 20px; }
.login-box label { display: block; font-size: 13px; margin: 12px 0 4px; color: #555; }
.login-box input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.login-box button {
    width: 100%; margin-top: 20px; padding: 10px; background: #2563eb; color: #fff;
    border: none; border-radius: 6px; font-size: 15px; cursor: pointer;
}
.login-box .error { color: #dc2626; font-size: 13px; }

/* Layout */
.topbar {
    background: #111827; color: #fff; padding: 16px 24px;
    display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { font-size: 18px; margin: 0; }
.logout-link { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

.flash {
    background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46;
    padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}

/* Stats */
.stats { display: flex; gap: 12px; margin-bottom: 24px; }
.stat-box {
    flex: 1; background: #fff; border-radius: 10px; padding: 16px;
    text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: block; text-decoration: none; color: inherit;
    border: 2px solid transparent; cursor: pointer;
}
.stat-box:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.stat-box strong { display: block; font-size: 26px; }
.stat-box span { font-size: 13px; color: #6b7280; }
.stat-box.active strong { color: #059669; }
.stat-box.blank strong { color: #d97706; }
.stat-box-selected { border-color: #2563eb; }

.filter-label { font-size: 13px; font-weight: 400; color: #6b7280; }

/* Create box */
.create-box {
    background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.create-box h2 { margin-top: 0; font-size: 16px; }
.create-box label { display: block; font-size: 13px; color: #555; margin: 12px 0 4px; }
.create-box input[type=number], .create-box input[type=text] {
    padding: 8px; border: 1px solid #ddd; border-radius: 6px; width: 260px;
}
.create-box button {
    display: block; margin-top: 16px; padding: 10px 18px; background: #2563eb;
    color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
.hint { font-size: 12px; color: #9ca3af; margin-top: 10px; }

/* Table */
.table-box { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.code-cell { font-weight: 700; font-family: monospace; font-size: 14px; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-blank { background: #fef3c7; color: #92400e; }

.redirect-url { font-family: monospace; font-size: 12px; word-break: break-all; margin-bottom: 6px; color: #374151; }

.update-form { display: flex; gap: 6px; flex-wrap: wrap; }
.update-form input[type=url] { flex: 1; min-width: 180px; padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }

.btn-small {
    padding: 6px 10px; font-size: 12px; border: none; border-radius: 6px;
    background: #e5e7eb; color: #111827; cursor: pointer;
}
.btn-small:hover { background: #d1d5db; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }

.qr-render { width: 110px; height: 110px; margin-bottom: 6px; }
.qr-render img, .qr-render canvas { width: 100% !important; height: 100% !important; }

/* Not found page */
.notfound-page { display: flex; align-items: center; justify-content: center; height: 100vh; text-align: center; }
.notfound-box h1 { font-size: 20px; margin-bottom: 8px; }
.notfound-box p { color: #6b7280; }
