* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Poppins', 'Roboto', sans-serif;
    color: #132018;
    background:
        linear-gradient(135deg, rgba(245, 250, 247, 0.96), rgba(232, 242, 236, 0.92)),
        url('/background-image');
    background-size: cover;
    background-attachment: fixed;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.hero {
    text-align: center;
    margin-bottom: 28px;
}

.hero-title {
    margin: 0;
    color: #15351f;
    font-size: clamp(2.3rem, 6vw, 5rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.hero-icon {
    width: clamp(72px, 12vw, 132px);
    height: clamp(72px, 12vw, 132px);
    margin: 18px auto 16px;
    color: #2f8b57;
    filter: drop-shadow(0 10px 20px rgba(47, 139, 87, 0.25));
}

.hero-copy,
.guide-copy {
    max-width: 820px;
    margin: 0 auto;
    color: #385343;
    font-size: 1.05rem;
    line-height: 1.65;
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
    gap: 24px;
    align-items: start;
}

.panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(47, 93, 66, 0.16);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(24, 55, 35, 0.12);
    padding: 24px;
}

.panel h2,
.plot-heading {
    margin: 0 0 16px;
    color: #1f3d2b;
    font-size: 1.2rem;
    font-weight: 700;
}

.search-mode {
    margin-bottom: 18px;
    color: #233b2b;
}

.search-mode label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin: 0;
    font-weight: 600;
}

.search-mode input {
    width: auto;
    margin: 0;
}

.stock-form {
    margin: 0 0 26px;
}

.stock-form:last-child {
    margin-bottom: 0;
}

.autocomplete-field {
    position: relative;
}

.stock-form input[type="text"] {
    width: 100%;
    padding: 0.95rem 1rem;
    margin-bottom: 0.9rem;
    border: 1px solid #bccdc1;
    border-radius: 6px;
    color: #17271d;
    font-size: 1rem;
    background: #fff;
}

.stock-form input[type="text"]:focus {
    border-color: #2f8b57;
    box-shadow: 0 0 0 3px rgba(47, 139, 87, 0.18);
    outline: none;
}

.suggestions {
    display: none;
    position: absolute;
    z-index: 10;
    top: calc(100% - 0.9rem);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    color: #233126;
    border: 1px solid #bccdc1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.suggestions button {
    width: 100%;
    display: block;
    padding: 0.7em 1em;
    border: 0;
    border-bottom: 1px solid #edf2ee;
    border-radius: 0;
    background: #fff;
    color: #233126;
    text-align: left;
    cursor: pointer;
}

.suggestions button:hover,
.suggestions button:focus {
    background: #eef8f1;
    outline: none;
}

.primary-button,
.secondary-button,
.bookmark-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
    width: 100%;
    min-height: 52px;
    color: #fff;
    background: #2f8b57;
    box-shadow: 0 10px 18px rgba(47, 139, 87, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.bookmark-button:hover {
    transform: translateY(-1px);
}

.primary-button:hover {
    background: #267648;
}

.secondary-button {
    min-height: 44px;
    padding: 0.75rem 1rem;
    color: #21432d;
    background: #e8f2ec;
}

.bookmark-button {
    min-height: 46px;
    padding: 0.75rem 1rem;
    color: #fff;
    background: #d43c2f;
}

.bookmark-button.saved {
    background: #2f8b57;
}

.guide-list {
    padding-left: 1.1rem;
    margin: 18px 0 0;
    color: #385343;
    line-height: 1.55;
}

.guide-list li {
    margin-bottom: 0.7rem;
}

.insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.insights-list li {
    margin-bottom: 0.7rem;
}

.insights-list a {
    color: #2f6f49;
    font-weight: 700;
    text-decoration: none;
}

.insights-list a:hover {
    text-decoration: underline;
}

.bookmarks-panel {
    margin-top: 24px;
}

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

.bookmark-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.bookmark-table th,
.bookmark-table td {
    padding: 0.85rem;
    border-bottom: 1px solid #e5ece7;
    text-align: left;
    white-space: nowrap;
}

.bookmark-table th {
    color: #244330;
    background: #eef6f1;
}

.bookmark-table th.sortable {
    cursor: pointer;
}

.bookmark-table a {
    color: #236b42;
    font-weight: 700;
    text-decoration: none;
}

.bookmark-table a:hover {
    text-decoration: underline;
}

.empty-bookmarks {
    margin: 0;
    color: #5c6f62;
}

.bookmarks-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.plot-container {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
    padding: 24px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(47, 93, 66, 0.16);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(24, 55, 35, 0.12);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.metric-card {
    padding: 0.85rem;
    border: 1px solid #dfe9e2;
    border-radius: 8px;
    background: #f7fbf8;
}

.metric-label {
    display: block;
    color: #526958;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-value {
    display: block;
    margin-top: 0.3rem;
    color: #1e3c29;
    font-size: 1.15rem;
    font-weight: 800;
}

.metric-value.divergence {
    color: #d43c2f;
}

.plot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
}

.plot-stack {
    display: grid;
    gap: 26px;
}

.plot-card {
    padding: 18px;
    border: 1px solid #dfe9e2;
    border-radius: 8px;
    background: #fff;
}

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

    .plot-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-button,
    .bookmark-button {
        width: 100%;
    }

    .metric-strip {
        grid-template-columns: 1fr;
    }
}
