* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #eef3f6;
    color: #26343d;
}

a {
    text-decoration: none;
    color: inherit;
}

.hidden {
    display: none;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b6f68, #174b7a);
}

.login-shell {
    width: 900px;
    max-width: 92%;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.brand-panel {
    padding: 44px;
    background: #0d736c;
    color: white;
}

.logo-mark {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: white;
    color: #0d736c;
    font-size: 34px;
    font-weight: bold;
}

.brand-panel h1 {
    margin: 26px 0 12px;
    font-size: 34px;
}

.brand-panel p {
    margin: 0;
    line-height: 1.8;
    opacity: 0.9;
}

.quick-info {
    margin-top: 28px;
    display: grid;
    gap: 10px;
    font-size: 14px;
}

.login-card {
    padding: 34px;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.tabs button {
    background: #f1f5f7;
}

.tabs .active {
    background: #0d736c;
    color: white;
}

label {
    display: block;
    margin-bottom: 14px;
    color: #53656f;
    font-size: 14px;
}

input,
select {
    width: 100%;
    height: 42px;
    margin-top: 7px;
    padding: 0 10px;
    border: 1px solid #cbd8df;
    border-radius: 6px;
    background: white;
    font-size: 15px;
}

button,
.func-btn {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

button {
    height: 40px;
    padding: 0 16px;
}

.main-btn {
    background: #0d736c;
    color: white;
}

.full-btn {
    width: 100%;
}

.message {
    min-height: 24px;
    margin-top: 12px;
    color: #0d736c;
}

.topbar,
.subbar {
    min-height: 96px;
    padding: 20px 7%;
    background: white;
    border-bottom: 1px solid #dce6eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1,
.subbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 8px 0 0;
    color: #667984;
}

.subbar a {
    color: #0d736c;
    font-weight: bold;
}

.admin-top {
    background: #26343d;
    color: white;
}

.admin-top p {
    color: #c9d4da;
}

.home-grid {
    width: 86%;
    max-width: 900px;
    margin: 48px auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.func-btn {
    min-height: 150px;
    padding: 32px;
    color: white;
    font-size: 26px;
    font-weight: bold;
    display: flex;
    align-items: end;
}

.green {
    background: #0d736c;
}

.blue {
    background: #2364aa;
}

.orange {
    background: #d97706;
}

.gray {
    background: #4b5d67;
}

.wide-panel {
    grid-column: 1 / 3;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.search-row input {
    margin-top: 0;
}

.page-wrap {
    width: 88%;
    max-width: 1180px;
    margin: 24px auto;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.panel {
    background: white;
    border: 1px solid #dce6eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
}

.panel h2 {
    margin: 0 0 18px;
    font-size: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.button-row {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.result-box {
    min-height: 160px;
    padding: 16px;
    border-radius: 8px;
    background: #f5f8fa;
    border: 1px solid #dce6eb;
    line-height: 1.8;
}

.path {
    margin-top: 12px;
    color: #0d736c;
    font-weight: bold;
}

.qr-box {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
    border: 1px dashed #0d736c;
    background: #f1fbf8;
    text-align: center;
}

.qr-image {
    width: 210px;
    min-height: 210px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid #dce6eb;
}

.qr-image img {
    width: 100%;
    height: auto;
    display: block;
}

.scanner-box {
    position: relative;
    min-height: 280px;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    border: 1px solid #26343d;
}

.scanner-box video {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.scanner-box::after {
    content: "";
    position: absolute;
    left: 18%;
    top: 16%;
    width: 64%;
    height: 64%;
    border: 3px solid #19a974;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

#cameraTip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
    color: white;
    background: rgba(0, 0, 0, 0.55);
    text-align: center;
    z-index: 2;
}

.manual-scan {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f5f8fa;
}

.manual-scan summary {
    cursor: pointer;
    color: #0d736c;
    font-weight: bold;
}

.gate-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.gate-mode label {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cbd8df;
    border-radius: 8px;
    background: #f5f8fa;
    color: #26343d;
}

.gate-mode input {
    width: auto;
    height: auto;
    margin: 0 6px 0 0;
}

.gate-result {
    min-height: 80px;
    margin-top: 16px;
    padding: 18px;
    border-radius: 8px;
    background: #f5f8fa;
    border: 1px solid #dce6eb;
    font-size: 20px;
    font-weight: bold;
}

.gate-result.ok {
    color: #0d736c;
    background: #effaf6;
}

.gate-result.bad {
    color: #b42318;
    background: #fff4f2;
}

.mini-link {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 6px;
    background: #0d736c;
    color: white;
}

.small-btn {
    height: 32px;
    padding: 0 10px;
    background: #0d736c;
    color: white;
    font-size: 13px;
}

.line-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.line-card {
    border: 1px solid #dce6eb;
    border-radius: 8px;
    padding: 14px;
    background: #fbfdfe;
}

.line-title {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: bold;
    margin-bottom: 8px;
}

.line-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.stations {
    color: #53656f;
    font-size: 13px;
    line-height: 1.8;
}

.stat-list,
.stats-grid {
    display: grid;
    gap: 12px;
}

.stats-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 18px;
}

.stat-list div,
.stats-grid div {
    padding: 16px;
    background: white;
    border: 1px solid #dce6eb;
    border-radius: 8px;
}

.stat-list span,
.stats-grid span {
    display: block;
    color: #667984;
    font-size: 13px;
    margin-bottom: 6px;
}

.stat-list strong,
.stats-grid strong {
    font-size: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 11px 9px;
    border-bottom: 1px solid #dce6eb;
    text-align: left;
}

th {
    background: #f5f8fa;
}

@media (max-width: 850px) {
    .login-shell,
    .two-col,
    .home-grid,
    .line-list,
    .stats-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .wide-panel {
        grid-column: 1;
    }
}
