* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    letter-spacing: 0;
    line-height: 1.5;
}

a {
    color: #0f766e;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
    font-weight: 700;
}

.topbar .logo img {
    height: 36px;
    width: auto;
    display: block;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #0f766e;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.brand-text {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
}

.nav a:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.nav a.active {
    background: #e6fffa;
    color: #0f766e;
    font-weight: 600;
}

.nav-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.lang-switch {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.lang-switch a {
    border-radius: 0;
    font-size: 12px;
    padding: 5px 8px;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 90px;
}

.hero {
    padding: 34px 0 26px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.hero h1,
.page-head h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.25;
}

.hero p,
.page-head p {
    margin: 0 0 16px;
    color: #4b5563;
}

.search-form {
    display: flex;
    gap: 8px;
    max-width: 720px;
    margin-top: 18px;
}

.search-form input[type="search"],
.search-form select {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    color: #1f2937;
}

.search-form input:focus,
.search-form select:focus {
    outline: 2px solid #99f6e4;
    border-color: #0f766e;
}

.search-form-compact {
    max-width: none;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.btn-primary {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.btn-primary:hover {
    background: #115e59;
}

.btn-small {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 13px;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.class-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.class-card:hover {
    border-color: #99f6e4;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.08);
    text-decoration: none;
}

.class-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.class-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #0f766e;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
}

.class-meta {
    color: #6b7280;
    font-size: 12px;
}

.class-card h2 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.class-notes {
    margin: 0 0 10px;
    color: #6b7280;
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.class-link {
    margin-top: auto;
    color: #0f766e;
    font-size: 13px;
    font-weight: 600;
}

.page-head {
    margin-bottom: 20px;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 13px;
}

.notes-box {
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
}

.notes-box summary {
    cursor: pointer;
    font-weight: 600;
}

.notes-box p {
    margin: 10px 0 0;
    white-space: pre-line;
    color: #374151;
}

.selection-bar {
    position: sticky;
    bottom: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 720px;
    margin: 18px auto 0;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(31, 41, 55, 0.12);
}

.selection-count {
    font-weight: 700;
}

.groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-block {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.group-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.group-summary::-webkit-details-marker {
    display: none;
}

.group-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 28px;
    padding: 0 8px;
    border-radius: 5px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
}

.group-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.group-count {
    color: #6b7280;
    font-size: 12px;
}

.group-select {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0f766e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.group-body {
    border-top: 1px solid #f3f4f6;
    padding: 10px 14px 14px;
}

.part-block {
    margin-top: 12px;
}

.part-block h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #374151;
}

.item-list {
    display: flex;
    flex-direction: column;
}

.item-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) minmax(120px, 0.55fr) minmax(90px, 0.4fr) 90px;
    gap: 8px;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
}

.item-row:hover {
    background: #f9fafb;
}

.item-row input {
    width: 16px;
    height: 16px;
    accent-color: #0f766e;
}

.item-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.item-code,
.item-class {
    color: #4b5563;
    font-size: 12px;
    font-family: Consolas, monospace;
    overflow-wrap: anywhere;
}

.item-source {
    color: #6b7280;
    font-size: 12px;
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.quote-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
}

.quote-items,
.panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 18px;
}

.quote-items h2,
.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.quote-class {
    margin-bottom: 20px;
}

.quote-class h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.data-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    white-space: nowrap;
}

.quote-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 76px;
}

.panel label {
    display: block;
    margin-bottom: 10px;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
}

.panel input,
.panel textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    color: #1f2937;
    font-weight: 400;
}

.panel input:focus,
.panel textarea:focus {
    outline: 2px solid #99f6e4;
    border-color: #0f766e;
}

.panel textarea {
    resize: vertical;
}

.hint {
    color: #6b7280;
    font-size: 12px;
}

.price-list {
    margin: 0;
}

.price-list div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.price-list dt {
    color: #4b5563;
}

.price-list dd {
    margin: 0;
    font-weight: 700;
}

.price-list .total {
    border-bottom: 0;
    padding-top: 12px;
    font-size: 17px;
}

.quote-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    padding-top: 30px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
}

.auth-card h1 {
    margin: 0 0 16px;
    font-size: 22px;
}

.auth-card label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.auth-card input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.auth-card .btn {
    width: 100%;
    margin-top: 6px;
}

.muted {
    color: #6b7280;
}

.empty-state {
    max-width: 560px;
    margin: 50px auto;
    padding: 30px;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
}

.empty-state h1 {
    margin: 0 0 8px;
}

.empty-state h2 {
    margin: 0 0 8px;
}

.alert {
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f766e;
}

.stat-label {
    color: #6b7280;
    font-size: 13px;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.search-list {
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    padding: 4px 12px;
}

.footer {
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 12px;
}

@media (max-width: 900px) {
    .quote-layout {
        grid-template-columns: 1fr;
    }

    .quote-side {
        position: static;
    }

    .item-row {
        grid-template-columns: 26px minmax(0, 1fr) 110px;
    }

    .item-code:nth-of-type(2),
    .item-source {
        display: none;
    }
}

@media (max-width: 620px) {
    .topbar-inner {
        padding: 8px 12px;
    }

    .container {
        padding: 18px 12px 90px;
    }

    .brand-text {
        max-width: 150px;
    }

    .hero h1,
    .page-head h1 {
        font-size: 23px;
    }

    .class-grid {
        grid-template-columns: 1fr;
    }

    .item-row {
        grid-template-columns: 24px minmax(0, 1fr);
        row-gap: 4px;
    }

    .item-name {
        font-size: 13px;
    }

    .item-code:first-of-type {
        grid-column: 2;
        font-size: 11px;
    }

    .search-form {
        flex-direction: column;
    }

    .footer-inner {
        flex-direction: column;
    }
}

.admin-detail .panel {
    margin-bottom: 16px;
}


/* Unified site header (shared pages) */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.site-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.site-header .logo img {
    height: 36px;
    width: auto;
    display: block;
}

.site-header .nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-header .nav a {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.site-header .nav a.active {
    color: #1a56db;
    background: #dbeafe;
    font-weight: 600;
}

.site-header .nav a:hover {
    color: #1a56db;
    background: #dbeafe;
    text-decoration: none;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}
