* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0; min-height: 100vh; display: grid; place-items: center;
    color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 18% 16%, rgba(20, 184, 166, .20), transparent 34%),
        radial-gradient(circle at 82% 82%, rgba(59, 130, 246, .18), transparent 34%),
        #f4f7fb;
}
.login-shell { width: min(940px, calc(100% - 32px)); display: grid; grid-template-columns: 1.05fr .95fr; }
.login-intro {
    min-height: 520px; padding: 58px; display: flex; flex-direction: column;
    justify-content: space-between; color: #fff; border-radius: 24px 0 0 24px;
    background: linear-gradient(145deg, #0f172a, #164e63);
    box-shadow: 0 26px 70px rgba(15, 23, 42, .20);
}
.login-mark {
    width: 52px; height: 52px; display: grid; place-items: center;
    border-radius: 15px; background: #14b8a6; font-size: 25px; font-weight: 750;
}
.login-intro h1 { margin: 28px 0 12px; font-size: 34px; line-height: 1.25; }
.login-intro p { max-width: 370px; margin: 0; color: #cbd5e1; font-size: 15px; line-height: 1.9; }
.login-intro small { color: #94a3b8; }
.login-card {
    min-height: 520px; padding: 72px 56px; border-radius: 0 24px 24px 0;
    background: rgba(255,255,255,.96); box-shadow: 0 26px 70px rgba(15, 23, 42, .14);
}
.login-card h2 { margin: 0 0 9px; font-size: 27px; }
.field { margin-bottom: 21px; }
.field label { display: block; margin-bottom: 8px; color: #334155; font-size: 14px; font-weight: 600; }
.field input {
    width: 100%; height: 48px; padding: 0 14px; border: 1px solid #dbe2ea;
    border-radius: 10px; background: #fff; color: #0f172a; font-size: 15px; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: #0f766e; box-shadow: 0 0 0 4px rgba(13, 148, 136, .11); }
.login-error {
    margin: -12px 0 18px; padding: 10px 12px; color: #b91c1c;
    border: 1px solid #fecaca; border-radius: 9px; background: #fef2f2; font-size: 14px;
}
.login-button {
    width: 100%; height: 48px; margin-top: 5px; border: 0; border-radius: 10px;
    background: #0f766e; color: #fff; font-size: 16px; font-weight: 650; cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 118, 110, .24);
}
.login-button:hover { background: #115e59; }
@media (max-width: 760px) {
    body { padding: 20px 0; }
    .login-shell { grid-template-columns: 1fr; }
    .login-intro { min-height: auto; padding: 32px; border-radius: 20px 20px 0 0; }
    .login-intro h1 { margin-top: 20px; font-size: 27px; }
    .login-intro small { display: none; }
    .login-card { min-height: auto; padding: 38px 30px; border-radius: 0 0 20px 20px; }
}
.panel {
    width: min(480px, calc(100% - 32px));
    padding: 36px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 52px rgba(15, 23, 42, .12);
}
.panel h1 { margin: 0 0 20px; }
.panel h2 { margin-top: 28px; font-size: 20px; }
.panel a { color: #0f766e; }
.panel nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.login-card h2 { margin-bottom: 30px; }
.logout { background: transparent; border: 0; padding: 8px 0; color: #0f766e; cursor: pointer; font: inherit; }

.guest-body, .admin-body {
    display: block;
    place-items: normal;
    padding: 0;
    background: #f3f7f6;
    color: #192b2a;
}
.guest-shell { width: min(100% - 32px, 500px); margin: 0 auto; padding: 36px 0; }
.guest-home { padding-top: clamp(40px, 14vh, 130px); }
.guest-card, .admin-card {
    background: #fff;
    border: 1px solid #dce7e4;
    border-radius: 16px;
    padding: clamp(20px, 5vw, 32px);
}
.guest-card { border-top: 4px solid #0f766e; box-shadow: 0 14px 40px rgba(25, 43, 42, .06); }
.guest-card h1, .page-heading h1 { font-size: clamp(26px, 4vw, 34px); margin: 0; line-height: 1.2; }
.intro-text { margin: 12px 0 22px; color: #4c615e; font-size: 14px; line-height: 1.7; }
.guest-links { display: grid; gap: 12px; }
.guest-link {
    padding: 17px 16px; display: flex; justify-content: space-between; gap: 12px;
    align-items: center; color: #0c635b; background: #eef8f5;
    border: 1px solid #cae6df; border-radius: 10px; text-decoration: none;
}
.guest-link:hover { background: #e1f3ed; }
.guest-footer, .back-link { display: inline-block; color: #365e58; font-size: 14px; text-underline-offset: 3px; }
.guest-footer { margin: 18px 0 0 4px; }
.back-link { margin: 0 0 14px 4px; }
.optional { color: #5c6c69; font-weight: 400; margin-left: 4px; }
.field select, .field textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #dbe2ea;
    border-radius: 10px; background: #fff; color: #0f172a; font: inherit;
}
.field select { height: 48px; padding-block: 0; }
.field textarea { display: block; resize: vertical; min-height: 110px; }
.field select:focus, .field textarea:focus {
    outline: none; border-color: #0f766e; box-shadow: 0 0 0 4px rgba(13, 148, 136, .11);
}
.button {
    min-height: 42px; display: inline-flex; justify-content: center; align-items: center;
    background: #fff; border: 1px solid #ccdcd7; border-radius: 8px; padding: 8px 15px;
    color: #0e625a; text-decoration: none; font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.button[hidden] { display: none; }
.button:hover { background: #eff7f4; }
.button-primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.button-primary:hover { background: #115e59; border-color: #115e59; }
.guest-submit { width: 100%; min-height: 48px; font-size: 16px; }
.form-error, .form-notice { padding: 12px 14px; border-radius: 8px; line-height: 1.6; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.form-notice { background: #eaf8ef; border: 1px solid #cce9d7; color: #166534; margin: 20px 0; }
.success-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px;
    min-height: 62px; padding: 8px max(16px, calc((100% - 1120px) / 2));
    background: #143c38; color: #fff;
}
.admin-brand { color: inherit; font-weight: 700; text-decoration: none; white-space: nowrap; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.admin-nav a { padding: 8px 10px; border-radius: 6px; color: #e3f0ed; text-decoration: none; font-size: 14px; }
.admin-nav a:hover, .admin-nav a[aria-current] { background: #275852; color: #fff; }
.admin-main { max-width: 1152px; margin: 0 auto; padding: 28px 16px 48px; }
.page-heading {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 12px 24px; margin-bottom: 22px;
}
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; }
.account-actions a { color: #0f766e; text-underline-offset: 3px; }
.account-actions span { overflow-wrap: anywhere; }
.admin-card { margin-bottom: 18px; }
.admin-card h2 { margin: 0 0 12px; font-size: 21px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
    display: grid; gap: 8px; padding: 16px; background: #fff; border: 1px solid #dce7e4;
    border-radius: 12px; color: inherit; text-decoration: none;
}
a.stat:hover { border-color: #7bb9ad; }
.stat span { color: #4c615e; font-size: 14px; }
.stat strong { font-size: clamp(25px, 4vw, 34px); color: #0c635b; overflow-wrap: anywhere; }
.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.qr-card { background: #f7faf9; border: 1px solid #e0ebe7; border-radius: 10px; padding: 16px; }
.qr-card h3 { margin: 0 0 12px; font-size: 16px; }
.qr-image img { display: block; width: min(100%, 152px); height: auto; margin-bottom: 12px; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.password-form { max-width: 440px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.filters .field { margin: 0; }
.search-field { flex: 1 1 min(100%, 250px); max-width: 370px; }
.filters .button { min-height: 48px; }
.result-count { color: #4c615e; font-size: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e1eae7; font-size: 14px; vertical-align: top; }
th { background: #eef5f2; color: #3a5650; white-space: nowrap; }
td { overflow-wrap: anywhere; min-width: 90px; }
.cell-created_at, .cell-phone, .cell-kind { white-space: nowrap; }
.cell-content { min-width: 220px; white-space: pre-wrap; }
.empty-state { padding: 26px 16px; background: #f7faf9; color: #4c615e; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pagination span { font-size: 14px; color: #4c615e; }
@media (max-width: 640px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qr-grid { grid-template-columns: 1fr; }
}
