:root {
    --background: #f6f7f9;
    --surface: #ffffff;
    --border: #e2e6ea;
    --text: #1d2530;
    --text-muted: #66707d;
    --accent: #0b6e4f;
    --buy: #0b6e4f;
    --watch: #b07a00;
    --monitor: #66707d;
    --negative: #b3372f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo { font-weight: 700; font-size: 17px; }

.site-header nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}

.site-header nav a:hover { color: var(--accent); }

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 32px 0 10px; }
h3 { font-size: 15px; margin: 24px 0 8px; }

td.comment {
    max-width: 420px;
    min-width: 260px;
    font-size: 13px;
    color: var(--text-muted);
}

.subtitle { color: var(--text-muted); margin: 0 0 24px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

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

th, td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td.wrap { white-space: normal; }

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td { border-bottom: none; }

.num { text-align: right; }

.label {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
}

.label-buy { background: var(--buy); }
.label-watch { background: var(--watch); }
.label-monitor { background: var(--monitor); }
.label-avoid { background: var(--negative); }

.flag {
    display: inline-block;
    padding: 1px 8px;
    margin: 1px 2px 1px 0;
    border-radius: 999px;
    font-size: 11px;
    background: #f1e9d7;
    color: #7a5b00;
    border: 1px solid #e3d3a8;
}

.positive { color: var(--buy); font-weight: 600; }
.negative { color: var(--negative); font-weight: 600; }
.muted { color: var(--text-muted); }

.empty-state {
    color: var(--text-muted);
    padding: 24px 0;
    text-align: center;
}

.score-bar {
    display: inline-block;
    width: 70px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
}

.score-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    resize: vertical;
}

form textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.form-hint { font-size: 13px; margin: 8px 0 16px; }

form button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

form button:hover { filter: brightness(1.1); }

form input[type="text"],
form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
}

form input[type="text"]:focus,
form input[type="password"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 8vh;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-card h1 { margin-bottom: 16px; }

.login-card button { width: 100%; }

.login-error {
    color: var(--negative);
    font-weight: 600;
    margin: 0 0 14px;
}

form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}

.trade-form .field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.trade-form .field {
    flex: 1 1 150px;
    min-width: 0;
}

.trade-form .field-wide { flex: 3 1 320px; }

.trade-form .field label {
    font-size: 13px;
    margin-bottom: 6px;
}

.trade-form input { margin-bottom: 14px; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.stat { padding: 14px 18px; margin-bottom: 0; }

.stat-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value { font-size: 19px; font-weight: 600; }

.stat-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.button-small {
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 5px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.button-small:hover { background: var(--accent); color: #fff; }

body.modal-open { overflow: hidden; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 38, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 16px;
    overflow-y: auto;
    z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px 22px 22px;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 18px 50px rgba(15, 22, 30, 0.25);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header h2 { margin: 0; font-size: 17px; }

.modal-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover { color: var(--text); }

.button-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.button-link:hover { color: var(--negative); }

.notice ul { margin: 8px 0; padding-left: 20px; }
.notice p { margin: 8px 0 0; }
.notice-success { border-left: 4px solid var(--buy); }
.notice-error { border-left: 4px solid var(--negative); }

footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 40px;
    color: var(--text-muted);
    font-size: 12px;
}
