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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
    color: #222;
    line-height: 1.5;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #1a1a2e;
    color: #eee;
}
nav .logo { color: #4fc3f7; text-decoration: none; font-weight: bold; font-size: 1.2rem; }
nav .nav-links { display: flex; gap: 1rem; align-items: center; }
nav a { color: #ccc; text-decoration: none; }
nav a:hover { color: #fff; }
.lang-switcher { display: flex; gap: 0.25rem; margin-left: 0.5rem; }
.lang-btn {
    background: transparent; border: 1px solid #555; color: #ccc;
    padding: 0.15rem 0.4rem; border-radius: 3px; cursor: pointer;
    font-size: 0.75rem; margin-top: 0;
}
.lang-btn:hover { background: #333; color: #fff; }
.lang-btn.active { background: #4fc3f7; color: #1a1a2e; border-color: #4fc3f7; font-weight: bold; }
main {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 { margin-bottom: 0.5rem; }
h2 { margin-bottom: 0.5rem; font-size: 1.1rem; color: #444; }

.step { background: #fff; padding: 1.25rem; border-radius: 8px; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

select, input[type="file"] {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font: inherit;
}
.select-row { display: flex; gap: 0.75rem; }
.select-row select { flex: 1; }

/* Search-select combo */
.search-select { position: relative; }
.search-select input[type="text"] {
    width: 100%; padding: 0.5rem; border: 1px solid #ccc;
    border-radius: 4px; font: inherit;
}
.search-select input[type="text"].has-value { border-color: #1a73e8; background: #f0f6ff; }
.search-select-dropdown {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 100;
    max-height: 260px; overflow-y: auto;
    background: #fff; border: 1px solid #ccc; border-top: none;
    border-radius: 0 0 4px 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.search-select-dropdown.hidden { display: none; }
.ss-item {
    padding: 0.4rem 0.6rem; cursor: pointer; font-size: 0.9rem;
}
.ss-item:hover, .ss-item.active { background: #e3f2fd; }
.ss-item .ss-vendor { color: #888; font-size: 0.8rem; }
.ss-item .ss-match { font-weight: bold; color: #1a73e8; }
.ss-group { padding: 0.3rem 0.6rem; font-size: 0.75rem; font-weight: 600; color: #888; background: #f5f5f5; }

button {
    padding: 0.5rem 1.25rem;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    margin-top: 0.5rem;
}
button:hover { background: #1557b0; }
button:disabled { background: #aaa; cursor: not-allowed; }

.result-box {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #e8f5e9;
    border-radius: 4px;
    border: 1px solid #a5d6a7;
}
.result-box.error { background: #fce4ec; border-color: #ef9a9a; }
.result-box a { color: #1a73e8; font-weight: bold; }

.hidden { display: none; }

/* Source tabs */
.source-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.source-tab {
    flex: 1; padding: 0.5rem; margin-top: 0;
    background: #eee; color: #555; border: 1px solid #ccc;
    border-radius: 4px; cursor: pointer; font: inherit; text-align: center;
}
.source-tab:hover { background: #ddd; }
.source-tab.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
#stock-config { width: 100%; }

/* Help icon */
.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.3rem; height: 1.3rem; padding: 0; margin: 0 0 0 0.35rem;
    font-size: 0.8rem; font-weight: bold; line-height: 1;
    background: #e0e0e0; color: #555; border: none; border-radius: 50%;
    cursor: pointer; vertical-align: middle;
}
.help-icon:hover { background: #1a73e8; color: #fff; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: #fff; border-radius: 10px; max-width: 520px; width: 100%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem; border-bottom: 1px solid #eee;
}
.modal-header h3 { font-size: 1.05rem; color: #333; }
.modal-close {
    background: none; border: none; font-size: 1.4rem; color: #888;
    cursor: pointer; padding: 0; margin: 0; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 1rem 1.25rem 1.25rem; }
.modal-body h4 { font-size: 0.95rem; color: #1a73e8; margin: 0.75rem 0 0.25rem; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { font-size: 0.9rem; color: #555; line-height: 1.5; }

.warning-list { margin-top: 0.5rem; padding-left: 1.25rem; font-size: 0.9rem; color: #795548; }

/* Help page */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: #fafafa; font-weight: 600; }
.help-section {
    background: #fff;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.help-section h2 { margin-bottom: 0.5rem; }
.help-section ol, .help-section ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.help-section li { margin-bottom: 0.3rem; }
.help-section p { margin: 0.4rem 0; }
.help-section code { background: #f0f0f0; padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.9em; }
.help-section kbd {
    background: #eee; border: 1px solid #ccc; border-radius: 3px;
    padding: 0.1rem 0.4rem; font-size: 0.85em; font-family: inherit;
    box-shadow: 0 1px 0 #bbb;
}
.help-section dt { font-weight: 600; margin-top: 0.75rem; }
.help-section dd { margin-left: 1rem; color: #555; }
.help-section a { color: #1a73e8; }
