* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #f5f6f8; color: #222; }
header { background: #2c3e50; color: #fff; padding: 12px 24px; }
header h1 { margin: 0 0 8px; font-size: 1.4rem; }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { color: #fff; text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav .disabled { color: #95a5a6; }
main { padding: 24px; }
main { max-width: 760px; }
main a { color: #1f6fb2; }
h2 { margin-top: 0; }
button, .button {
    display: inline-block; min-width: 34px; padding: 6px 10px; font: inherit; line-height: 1.2;
    text-align: center; color: #222; text-decoration: none; cursor: pointer;
    background: #fff; border: 1px solid #c8ced6; border-radius: 4px;
}
button:hover:not(:disabled), .button:hover { background: #eef1f5; }
button:disabled { color: #b5bcc5; cursor: default; }
button.primary { color: #fff; background: #2c3e50; border-color: #2c3e50; }
button.primary:hover:not(:disabled) { background: #3b5269; }
.message { padding: 10px 12px; color: #1e6b3a; background: #e3f4e8; border-radius: 4px; }
.empty { color: #66707c; }
.name-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.name-form input[type="text"] { flex: 1 1 240px; min-width: 0; padding: 7px 9px; font: inherit; border: 1px solid #c8ced6; border-radius: 4px; }
.field-error { flex-basis: 100%; margin: 0; color: #b3261e; }
.item-list { margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; }
.item-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.item-list li + li { border-top: 1px solid #edf0f3; }
.item-name, .placement-title { min-width: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tag { margin-left: 8px; padding: 2px 8px; font-size: 0.85em; color: #4a5561; background: #eef1f5; border-radius: 10px; white-space: nowrap; }
[hidden] { display: none !important; }
main.wide { max-width: 1120px; }
h3 { margin: 24px 0 10px; font-size: 1.1rem; }
.message.error { color: #8c1d18; background: #fbe7e6; }
.hint { color: #66707c; font-size: 0.9em; }
.info { color: #3d4955; }
.button.primary { color: #fff; background: #2c3e50; border-color: #2c3e50; }
.button.primary:hover { background: #3b5269; }
button.danger { color: #b3261e; border-color: #e3b6b2; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.title-row h2 { margin: 0; }
.snapshot-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 8px; }
.snapshot-header label { display: inline-flex; align-items: center; gap: 8px; }
.snapshot-header input, .snapshot-header select, .entries input, .entries select {
    min-width: 0; padding: 6px 8px; font: inherit; background: #fff; border: 1px solid #c8ced6; border-radius: 4px;
}
.entries input:disabled { background: #f0f2f5; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; }
thead th { font-weight: 600; color: #4a5561; background: #f8f9fb; border-bottom: 1px solid #dfe3e8; white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid #edf0f3; }
tfoot td { font-weight: 600; border-top: 1px solid #dfe3e8; }
.num { text-align: right; white-space: nowrap; }
.entries { min-width: 920px; }
.entries td { padding: 6px 6px; }
.entries .cell-asset input { width: 100%; min-width: 150px; }
.entries .cell-class select { width: 100%; min-width: 130px; }
.entries .cell-network input { width: 100%; min-width: 120px; }
.entries .cell-num input { width: 120px; text-align: right; }
.entries .cell-sum { padding-top: 12px; text-align: right; white-space: nowrap; }
.entries .class-name { display: inline-block; padding-top: 6px; }
.entries .cell-actions { white-space: nowrap; }
.entries tr.carried { background: #fbfcfd; }
.entries .field-error, .entries .note { display: block; margin-top: 4px; font-size: 0.85em; }
.note { color: #8a5a00; }
.since { margin-left: 6px; font-size: 0.85em; white-space: nowrap; }
.form-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.recent { margin-top: 32px; }
.recent-meta { display: flex; flex-wrap: wrap; gap: 12px; }
.history { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; }
.message.warning { color: #6b4a00; background: #fdf3dc; }
.message.warning a { color: inherit; font-weight: 600; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid #dfe3e8; }
.tabs a { padding: 8px 14px; color: #4a5561; text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a.active { color: #222; font-weight: 600; border-bottom-color: #2c3e50; }
.issues { margin-bottom: 24px; }
.issues h3 { margin-top: 0; color: #6b4a00; }
.issues li { flex-wrap: wrap; }
.issue-place { display: flex; flex-wrap: wrap; gap: 12px; }
.issue-problem { color: #8a5a00; }
.search { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.search input { padding: 6px 8px; font: inherit; border: 1px solid #c8ced6; border-radius: 4px; }
td.actions { display: table-cell; white-space: nowrap; }
td.actions form { display: inline; }
.tag.blocked { color: #8c1d18; background: #fbe7e6; }
.entries tr.row-issue { background: #fff8e8; }
.name-form select { padding: 6px 8px; font: inherit; border: 1px solid #c8ced6; border-radius: 4px; }
#directory .item-name { overflow-wrap: break-word; }
.portfolio-total { margin: 0; font-size: 1.1rem; }
.tabs button { padding: 8px 14px; color: #4a5561; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; }
.tabs button:hover:not(:disabled) { background: none; color: #222; }
.tabs button[aria-selected="true"] { color: #222; font-weight: 600; border-bottom-color: #2c3e50; }
td.share { white-space: nowrap; }
.share-wrap { display: flex; align-items: center; gap: 10px; }
.share-value { min-width: 52px; text-align: right; }
.bar { display: inline-block; width: 160px; height: 10px; background: #edf0f3; border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: #3b6ea5; border-radius: 5px; }
.blocked-line { margin-top: 12px; color: #8c1d18; }
@media (max-width: 600px) { .bar { width: 60px; } }
.tabs { overflow-x: auto; }
.tabs a, .tabs button { white-space: nowrap; }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; align-items: start; margin-bottom: 16px; }
.trade-grid label { display: flex; flex-direction: column; gap: 6px; }
.trade-grid input, .trade-grid select { padding: 6px 8px; font: inherit; background: #fff; border: 1px solid #c8ced6; border-radius: 4px; }
.trade-grid input:disabled { background: #f0f2f5; }
.trade-grid .class-name { padding: 7px 0; }
.trade-grid .field-error, .trade-grid .note { font-size: 0.85em; }
.computed { align-self: end; padding: 7px 0; }
.allocations { margin-top: 8px; }
.allocation-table .allocation { width: 120px; padding: 6px 8px; font: inherit; text-align: right; border: 1px solid #c8ced6; border-radius: 4px; }
.allocation-table .field-error { display: block; font-size: 0.85em; }
#distributed.mismatch { color: #b3261e; }
.tag.buy { color: #1e6b3a; background: #e3f4e8; margin-left: 0; }
.tag.sell { color: #6b4a00; background: #fdf3dc; margin-left: 0; }
td.gain { color: #1e6b3a; }
td.loss { color: #b3261e; }

.price-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; flex-basis: 100%; margin: 4px 0 8px; padding: 12px 14px; border: 1px solid #dfe3e8; border-radius: 6px; }
.price-settings legend { padding: 0 6px; font-weight: 600; }
.price-settings label { display: inline-flex; align-items: center; gap: 8px; }
.price-settings input[type="text"], .price-settings select { padding: 6px 8px; font: inherit; border: 1px solid #c8ced6; border-radius: 4px; }
.price-settings .message, .price-settings .hint, .price-settings .field-error { flex-basis: 100%; margin: 0; }
.price-error { display: block; color: #b3261e; }
.notify-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; flex-basis: 100%; }
.notify-settings input[type="text"] { width: 90px; }
.notification-text { white-space: pre-line; }
.notifications td { white-space: nowrap; }
.notifications td.notification-text { white-space: pre-line; }
.name-form input.threshold-input { flex: 0 0 110px; }
.notify-settings label { white-space: nowrap; }

.logout { display: inline; margin-left: auto; }
.logout button { padding: 0; min-width: 0; color: #fff; background: none; border: none; }
.logout button:hover:not(:disabled) { background: none; text-decoration: underline; }
.login-header { padding-bottom: 12px; }
main.login { max-width: 380px; margin: 40px auto; }
.login-form { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; }
.login-form label:not(.check) { display: flex; flex-direction: column; gap: 6px; }
.login-form input[type="text"], .login-form input[type="password"] { padding: 8px 10px; font: inherit; border: 1px solid #c8ced6; border-radius: 4px; }
