:root {
  --bg: #f6f7fa;
  --bg-2: #eef0f5;
  --panel-solid: #ffffff;
  --row-hover: #f2f4f8;
  --border: #dde1e9;
  --border-soft: #e7eaf0;
  --blue: #3b6fd4;
  --blue-dim: #2f5bb0;
  --green: #16a374;
  --amber: #b9791a;
  --red: #d43d55;
  --text: #1a2030;
  --text-dim: #5b6478;
  --text-faint: #8993a8;
  --icon-btn-bg: #e7eaf2;
  --icon-btn-border: #c7cddb;
  --icon-btn-color: #4d5568;
  --icon-btn-hover-bg: #dbe2f2;
  --topbar-bg: rgba(246,247,250,.85);
  --on-accent: #ffffff;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(.19,1,.22,1);
  --ease-soft: cubic-bezier(.25,.1,.25,1);
  --t-fast: .16s;
  --t-med: .28s;
}
[data-theme="dark"] {
  --bg: #0f1115;
  --bg-2: #141820;
  --panel-solid: #1a1f29;
  --row-hover: #242b38;
  --border: #2b3240;
  --border-soft: #232936;
  --blue: #7c8cf8;
  --blue-dim: #a98bf5;
  --green: #6fd4a6;
  --amber: #ecb55c;
  --red: #f07777;
  --text: #eef0f5;
  --text-dim: #b9c0cd;
  --text-faint: #7e879a;
  --icon-btn-bg: #1e2430;
  --icon-btn-border: #2b3240;
  --icon-btn-color: #b9c0cd;
  --icon-btn-hover-bg: #242b38;
  --topbar-bg: rgba(15,17,21,.85);
  --on-accent: #ffffff;
}
body { transition: background var(--t-med, .28s) ease, color var(--t-med, .28s) ease; }
*, *::before, *::after {
  transition: background-color var(--t-med, .28s) ease, border-color var(--t-med, .28s) ease, color var(--t-med, .28s) ease;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }

/* LOGIN SCREEN */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 500px at 50% -10%, rgba(59,111,212,0.08), transparent 60%);
  animation: fadeIn .4s var(--ease);
}
.login-card {
  width: 360px; background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px;
  box-shadow: 0 1px 3px rgba(20,25,40,0.04), 0 12px 32px -12px rgba(20,25,40,0.10);
  animation: riseIn .5s var(--ease) .05s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.login-brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 18px; margin-bottom: 28px; }
.login-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(22,163,116,.5); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 12px; border-radius: 8px; font-size: 14px;
  transition: border-color var(--t-fast) var(--ease-soft), box-shadow var(--t-fast) var(--ease-soft);
}
.field input:focus { border-color: var(--blue-dim); box-shadow: 0 0 0 3px rgba(59,111,212,0.12); }
.btn {
  border: none; border-radius: 8px; font-weight: 600; font-size: 13.5px; padding: 11px 18px;
  transition: transform .12s var(--ease-soft), background var(--t-fast) var(--ease-soft), opacity var(--t-fast), box-shadow var(--t-fast);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-dim)); color: #fff; box-shadow: 0 6px 16px -6px rgba(124,140,248,.5); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-full { width: 100%; justify-content: center; margin-top: 6px; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); background: var(--row-hover); }
.btn-danger { background: rgba(212,61,85,0.08); color: var(--red); border: 1px solid rgba(212,61,85,0.25); }
.btn-danger:hover { background: rgba(212,61,85,0.16); }
.msg { margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; display: none; }
.msg.ok, .msg.err { display: block; animation: msgIn .25s var(--ease-soft); }
.msg.ok { background: rgba(22,163,116,0.08); color: var(--green); border: 1px solid rgba(22,163,116,0.22); }
.msg.err { background: rgba(212,61,85,0.08); color: var(--red); border: 1px solid rgba(212,61,85,0.22); }
@keyframes msgIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* APP SHELL */
#app-screen { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: var(--panel-solid); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 16px; padding: 8px 8px 22px; }
.sidebar-brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(22,163,116,.5); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500; cursor: pointer; margin-bottom: 2px;
  transition: color var(--t-fast) var(--ease-soft), background var(--t-fast) var(--ease-soft), padding-left var(--t-med) var(--ease);
}
.nav-item:hover { color: var(--text); background: var(--row-hover); padding-left: 15px; }
.nav-item.active { color: var(--blue-dim); background: rgba(59,111,212,0.08); }
.nav-item .icon { width: 16px; text-align: center; opacity: .85; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--topbar-bg); backdrop-filter: blur(8px); z-index: 20;
}
.topbar h1 { font-family: var(--display); font-size: 19px; font-weight: 600; }
.search-box { position: relative; flex: 1; max-width: 320px; }
.search-box input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px 9px 32px; border-radius: 8px; font-size: 13.5px;
}
.search-box .icn { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 13px; }
.content { padding: 24px 28px 60px; }
.content > div:not(.hidden) { animation: viewIn .3s var(--ease-soft); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fab { animation: fabIn .4s var(--ease) .1s both; }
@keyframes fabIn { from { opacity: 0; transform: scale(.8) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* TABLE */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; min-height: 40px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; }
select.sortsel {
  background: var(--panel-solid); border: 1px solid var(--border); color: var(--text-dim);
  padding: 8px 10px; border-radius: 8px; font-size: 13px; height: 36px;
}
#bulk-proxy-select { height: 36px; }
#bulk-bar .btn { padding: 8px 16px; height: 36px; }
.acc-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.acc-table td, .acc-table th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-table td.note-cell { white-space: normal; }
.acc-table td:first-child, .acc-table td:last-child { overflow: visible; }
.acc-table thead th {
  text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint);
  padding: 0 14px 10px; font-weight: 600;
}
.acc-table tbody tr {
  border-top: 1px solid var(--border-soft);
  transition: background var(--t-fast) var(--ease-soft);
  animation: rowIn .4s var(--ease-soft) both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.acc-table tbody tr:nth-child(n+1) { animation-delay: calc(var(--i, 0) * 18ms); }
.acc-table tbody tr:hover { background: var(--row-hover); }
.acc-table td { padding: 13px 14px; font-size: 13.5px; vertical-align: middle; }
.mono { font-family: var(--mono); }
.copyable { cursor: pointer; transition: color var(--t-fast) var(--ease-soft); }
.copyable:hover { color: var(--blue) !important; }
.copyable.copied { color: var(--green) !important; }
.login-cell { display: flex; align-items: center; gap: 8px; }
.confirm-badge {
  background: var(--green); color: var(--on-accent); font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; font-family: var(--mono);
}
.pass-cell { color: var(--text-dim); }
.otp-code { font-weight: 600; letter-spacing: 1.5px; font-size: 13.5px; }
.otp-bar-track { width: 60px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.otp-bar-fill { height: 100%; background: var(--green); transition: width 1s linear, background .3s; }
.note-cell { color: var(--text-dim); }
.editable-note { cursor: text; min-width: 60px; min-height: 20px; border-radius: 4px; padding: 2px 6px; margin: -2px -6px; transition: background var(--t-fast) var(--ease-soft); position: relative; }
.editable-note:hover { background: var(--row-hover); }
.editable-note:empty::before { content: '+ добавить'; color: var(--text-faint); font-style: italic; font-size: 12.5px; }
.editable-note.editing { overflow: visible !important; z-index: 55; }
.note-popover {
  position: absolute; top: -10px; left: -10px; z-index: 60;
  background: var(--panel-solid); border: 1px solid var(--blue-dim); border-radius: 8px;
  padding: 6px; box-shadow: 0 14px 30px -8px rgba(0,0,0,.4);
}
.note-popover textarea {
  display: block; width: 300px; min-height: 70px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 8px 10px; font-size: 13.5px; font-family: var(--body);
  resize: vertical; line-height: 1.5;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 7px; flex-shrink: 0; }
.status-online { background: var(--green); box-shadow: 0 0 5px rgba(22,163,116,.5); }
.status-off { background: var(--text-faint); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--icon-btn-border); background: var(--icon-btn-bg);
  color: var(--icon-btn-color); display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: color var(--t-fast) var(--ease-soft), border-color var(--t-fast) var(--ease-soft), background var(--t-fast) var(--ease-soft), transform .12s var(--ease-soft);
}
.icon-btn:hover { color: var(--text); border-color: var(--blue-dim); background: var(--icon-btn-hover-bg); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(.94); }
.icon-btn.accept { background: rgba(22,163,116,0.10); border-color: rgba(22,163,116,0.3); color: var(--green); }
.icon-btn.accept:hover { background: rgba(22,163,116,0.18); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(212,61,85,0.4); }
.icon-btn:disabled { opacity: .4; cursor: default; transform: none; }
@keyframes otpFlash { 0% { color: var(--blue); } 100% { color: var(--text); } }
.otp-code.flash { animation: otpFlash .5s var(--ease-soft); }
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-faint); }
.empty-state .big { font-family: var(--display); font-size: 18px; color: var(--text-dim); margin-bottom: 8px; }

/* FLOATING ADD BUTTON + MODAL */
.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 999;
  background: linear-gradient(135deg, var(--blue), var(--blue-dim)); color: #fff; border: none; border-radius: 999px; padding: 14px 22px;
  font-weight: 700; font-size: 14px; box-shadow: 0 10px 26px -10px rgba(59,111,212,0.5); display: flex; align-items: center; gap: 8px;
}
.fab:hover { background: var(--blue-dim); }
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,25,38,.45); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.overlay.show { display: flex; animation: overlayIn .18s var(--ease-soft); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.overlay.show .modal { animation: modalIn .3s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal { width: 380px; max-width: 100%; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 14px; padding: 26px; box-shadow: 0 20px 50px -15px rgba(20,25,40,.25); }
.modal-wide { width: 560px; }
.combo { position: relative; }
.combo input { width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 11px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.combo input:focus { border-color: var(--blue-dim); box-shadow: 0 0 0 3px rgba(59,111,212,0.12); }
.combo-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 80;
  max-height: 210px; overflow-y: auto; background: var(--panel-solid);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 34px -10px rgba(0,0,0,.45); padding: 4px;
}
.combo-list.show { display: block; }
.combo-group { padding: 7px 10px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; }
.combo-opt { padding: 8px 10px; border-radius: 6px; font-size: 13.5px; cursor: pointer; transition: background var(--t-fast) var(--ease-soft); }
.combo-opt:hover { background: var(--row-hover); }
.combo-opt.accent { color: var(--blue); }
.combo-empty { padding: 10px; font-size: 12.5px; color: var(--text-faint); }
.inventory-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px;
  max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-2);
}
.inv-item {
  border: 2px solid transparent; border-radius: 8px; padding: 6px; cursor: pointer; background: var(--panel-solid);
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
  transition: border-color var(--t-fast) var(--ease-soft), transform .12s var(--ease-soft);
}
.inv-item:hover { transform: translateY(-2px); }
.inv-item.selected { border-color: var(--blue); background: rgba(59,111,212,0.08); }
.inv-item img { width: 56px; height: 56px; object-fit: contain; }
.inv-item .nm { font-size: 10.5px; color: var(--text-dim); line-height: 1.25; max-height: 26px; overflow: hidden; }
.inv-item.untradable { opacity: .4; cursor: not-allowed; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head strong { font-family: var(--display); font-size: 15px; }
.modal-close { color: var(--text-faint); font-size: 20px; cursor: pointer; line-height: 1; }
.hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin-top: 6px; margin-bottom: 16px; }
.tab-row { display: flex; gap: 4px; background: var(--bg-2); border-radius: 8px; padding: 3px; margin-bottom: 18px; }
.tab-btn { flex: 1; text-align: center; padding: 7px; border-radius: 6px; font-size: 12.5px; color: var(--text-dim); background: transparent; border: none; transition: all var(--t-fast) var(--ease-soft); }
.tab-btn.active { background: var(--panel-solid); color: var(--text); box-shadow: 0 1px 2px rgba(20,25,40,.08); }

/* NOTES */
.notes-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; height: calc(100vh - 160px); }
.notes-list { overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 12px; padding: 8px; background: var(--panel-solid); }
.note-item {
  padding: 12px 12px; border-radius: 8px; cursor: grab; margin-bottom: 3px; touch-action: none; position: relative;
  transition: background var(--t-fast) var(--ease-soft), padding-left var(--t-med) var(--ease), transform .15s var(--ease-soft);
}
.note-item:hover { background: var(--row-hover); padding-left: 15px; }
.note-item.active { background: rgba(59,111,212,0.08); }
.note-item .t { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.note-item .d { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.note-editor {
  border: 1px solid #d8d4c8; border-radius: 12px; padding: 0; display: flex; flex-direction: column;
  background: #f7f6f2; overflow: hidden; min-height: 0;
}
.note-editor input.title {
  background: transparent; border: none; color: #1a1a16; font-family: var(--display); font-size: 18px; font-weight: 600;
  padding: 18px 20px 12px;
}
.note-toolbar {
  display: flex; gap: 2px; padding: 6px 16px; border-top: 1px solid #e3e0d5; border-bottom: 1px solid #e3e0d5;
  background: #ece9e1;
}
.note-toolbar button {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px; color: #3a3a34; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .16s ease, color .16s ease;
}
.note-toolbar button:hover { background: rgba(0,0,0,.08); color: #000; }
.format-select {
  background: transparent; border: 1px solid #c9c5b8; border-radius: 6px; color: #4a4a42;
  font-size: 12.5px; padding: 5px 8px; height: 30px;
}
.toolbar-sep { width: 1px; height: 20px; background: #c9c5b8; margin: 0 4px; align-self: center; }
#note-body {
  flex: 1; outline: none; font-size: 14px; line-height: 1.55; overflow-y: auto; color: #1e1e1a;
  padding: 18px 20px; min-height: 0; background: #f7f6f2;
}
#note-body div, #note-body p { margin: 0 0 2px; }
#note-body h2 { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 10px 0 4px; }
#note-body h3 { font-family: var(--display); font-size: 15.5px; font-weight: 600; margin: 8px 0 4px; }
#note-body blockquote { border-left: 3px solid #b8b4a4; margin: 6px 0; padding: 2px 0 2px 12px; color: #55524a; }
#note-body pre { background: #ddd9cc; border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; margin: 6px 0; }
#note-body a { color: #1a5fc4; }
#note-body, #note-body *:not(a) { color: #1e1e1a !important; }
.note-editor-actions { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid #e3e0d5; background: #ece9e1; }
.note-editor-actions .btn-ghost { color: #4a4a42; border-color: rgba(0,0,0,.18); }
.note-editor-actions .btn-ghost:hover { color: #1a1a16; border-color: rgba(0,0,0,.35); background: rgba(0,0,0,.05); }
.note-item.dragging {
  cursor: grabbing; transition: none; z-index: 50; background: var(--panel-solid);
  box-shadow: 0 10px 24px -6px rgba(0,0,0,.35); pointer-events: none;
}

/* SETTINGS */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 20px; max-width: 1560px; align-items: start; }
.card { background: var(--panel-solid); border: 1px solid var(--border-soft); border-radius: 12px; padding: 22px; }
.card h3 { font-family: var(--display); font-size: 15px; margin-bottom: 16px; }
.proxy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 8px;
  transition: background var(--t-fast) var(--ease-soft);
}
.proxy-row:hover { background: var(--row-hover); }
.proxy-row .info { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proxy-row .label { color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.proxy-row .count { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.proxy-row .acts { display: flex; gap: 6px; flex-shrink: 0; }
.proxy-row.editing input { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; border-radius: 6px; font-size: 12.5px; width: 100%; margin-bottom: 5px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; height: auto; }
}

/* аватары аккаунтов */
.acc-avatar {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; font-family: var(--body);
  background: var(--acc-color); box-shadow: 0 3px 10px -4px var(--acc-color);
}
.trade-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 8px;
}
.trade-row .info { font-size: 13px; }
.trade-row .sub { font-size: 11px; color: var(--text-faint); font-family: var(--mono); margin-top: 2px; }

/* переключатель вида */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--panel-solid); margin-left: 10px; }
.view-toggle button { border: 0; background: transparent; color: var(--text-dim); padding: 7px 13px; font-size: 12.5px; cursor: pointer; font-weight: 600; transition: background var(--t-fast) var(--ease-soft), color var(--t-fast) var(--ease-soft); }
.view-toggle button.on { background: var(--blue); color: #fff; }

/* плитки аккаунтов */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; margin-top: 14px; }
.acc-card {
  position: relative; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 18px 14px; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .16s var(--ease-soft), border-color .16s, box-shadow .16s;
  animation: rowIn .4s var(--ease-soft) both;
}
.acc-card:hover { transform: translateY(-3px); border-color: var(--acc-color); box-shadow: 0 20px 46px -20px rgba(0,0,0,.5); }
.acc-card .glow { position: absolute; top: -46px; right: -46px; width: 132px; height: 132px; border-radius: 50%; filter: blur(34px); opacity: .35; pointer-events: none; background: var(--acc-color); }
.acc-card .card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.acc-card .card-avatar { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; background: var(--acc-color); }
.acc-card .card-login { font-weight: 650; font-size: 14.5px; word-break: break-all; }
.acc-card .card-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.acc-card .card-field { margin: 8px 0; }
.acc-card .card-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 650; margin-bottom: 4px; }
.acc-card .card-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 9px; padding: 7px 10px; }
.acc-card .card-val { font-family: var(--mono); font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card .card-code { color: var(--text); font-weight: 700; letter-spacing: .08em; font-size: 14.5px; font-family: var(--mono); }
.acc-card .card-note { margin-top: 10px; min-height: 20px; font-size: 12.5px; color: var(--text-dim); }
.acc-card .card-actions { display: flex; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); justify-content: flex-end; }

/* размеры векторных иконок */
.icon-btn svg { width: 15px; height: 15px; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.view-toggle button { display: inline-flex; align-items: center; gap: 6px; }
.view-toggle button svg { width: 14px; height: 14px; }
.acc-card .card-actions .icon-btn svg { width: 14px; height: 14px; }

/* прокрутка в общем стиле */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
.combo-list, .inventory-grid, .notes-list, #note-body { scrollbar-width: thin; }

/* сбор с нескольких аккаунтов */
.gather-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-2); padding: 4px; }
.gather-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; transition: background var(--t-fast) var(--ease-soft); }
.gather-item:hover { background: var(--row-hover); }
.gather-item .mini-avatar { width: 22px; height: 22px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 700; background: var(--acc-color); flex-shrink: 0; }
.gather-log { max-height: 170px; overflow-y: auto; margin-top: 12px; border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 10px; background: var(--bg-2); font-family: var(--mono); font-size: 11.5px; line-height: 1.7; }
.gather-log .ok { color: var(--green); }
.gather-log .err { color: var(--red); }
.gather-log .neutral { color: var(--text-faint); }

/* строки выбора аккаунтов при сборе */
.gather-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 13.5px; user-select: none;
  transition: background var(--t-fast) var(--ease-soft), border-color var(--t-fast) var(--ease-soft);
}
.gather-item:hover { background: var(--row-hover); }
.gather-item.picked { background: rgba(124,140,248,.14); border-color: var(--blue); }
.gather-item .pick-mark { margin-left: auto; opacity: 0; color: var(--blue); display: flex; }
.gather-item.picked .pick-mark { opacity: 1; }
.gather-item .pick-mark svg { width: 16px; height: 16px; }
.gather-count { font-size: 12px; color: var(--text-faint); margin-left: auto; }

/* колонки настроек — карточки идут подряд без пустот */
.settings-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

/* тарифы */
.plan-card {
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  transition: border-color var(--t-fast) var(--ease-soft), background var(--t-fast) var(--ease-soft);
}
.plan-card:hover { border-color: var(--blue); background: var(--row-hover); }
.plan-card.current { border-color: var(--green); background: rgba(52,211,153,.07); }
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.plan-title { font-family: var(--display); font-weight: 600; font-size: 15px; }
.plan-price { font-family: var(--mono); font-weight: 700; color: var(--blue); }
.plan-limits { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; margin-bottom: 10px; }
.usage-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.usage-row:last-child { border-bottom: none; }
.usage-bar { width: 110px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--blue); }
.usage-bar i.warn { background: var(--amber); }
.usage-bar i.full { background: var(--red); }
.inv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.inv-row:last-child { border-bottom: none; }
.inv-status { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.inv-status.PAID { background: rgba(52,211,153,.14); color: var(--green); }
.inv-status.PENDING { background: rgba(245,185,66,.14); color: var(--amber); }
.inv-status.EXPIRED, .inv-status.CANCELLED { background: rgba(242,89,107,.12); color: var(--red); }

/* предупреждение о подписке */
.sub-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 16px 28px -4px; padding: 13px 18px; border-radius: 11px; font-size: 13.5px;
  border: 1px solid var(--amber); background: rgba(236,181,92,.10); color: var(--amber);
  animation: msgIn .3s var(--ease-soft);
}
.sub-banner.critical { border-color: var(--red); background: rgba(240,119,119,.10); color: var(--red); }
.sub-banner .btn { flex-shrink: 0; }
.is-expired .fab { display: none !important; }
.is-expired .icon-btn.accept, .is-expired [data-act="check"] { opacity: .35; pointer-events: none; }

/* файловый менеджер */
.files-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; flex-wrap: wrap; }
.crumbs a { color: var(--blue); cursor: pointer; }
.crumbs span.sep { color: var(--text-faint); }
.crumbs .cur { color: var(--text-dim); }
.files-drop { border: 1px dashed var(--border); border-radius: 12px; padding: 8px; min-height: 220px; transition: border-color var(--t-fast) var(--ease-soft), background var(--t-fast) var(--ease-soft); }
.files-drop.over { border-color: var(--blue); background: rgba(124,140,248,.08); }
.files-hint { text-align: center; margin: 10px 0 4px; }
.files-list { display: flex; flex-direction: column; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; transition: background var(--t-fast) var(--ease-soft); }
.file-row:hover { background: var(--row-hover); }
.file-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg-2); font-size: 14px; }
.file-icon.dir { background: rgba(124,140,248,.16); color: var(--blue); }
.file-icon.arch { background: rgba(236,181,92,.16); color: var(--amber); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.file-name.clickable { cursor: pointer; }
.file-name.clickable:hover { color: var(--blue); }
.file-meta { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); flex-shrink: 0; }
.file-acts { display: flex; gap: 6px; flex-shrink: 0; }
.files-empty { text-align: center; padding: 40px 10px; color: var(--text-faint); font-size: 13.5px; }

/* просмотр архивов */
.archive-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-2); padding: 4px; }
.arch-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; font-size: 13px; }
.arch-row:hover { background: var(--row-hover); }
.arch-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.arch-row .nm.clickable { cursor: pointer; }
.arch-row .nm.clickable:hover { color: var(--blue); }
.arch-row .sz { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.archive-preview { margin-top: 14px; border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px; background: var(--bg-2); max-height: 320px; overflow: auto; }
.archive-preview pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0; color: var(--text); }
.archive-preview img { max-width: 100%; border-radius: 8px; }
.archive-back { margin-bottom: 10px; }

/* просмотрщик файлов */
.modal-viewer { width: 860px; max-width: 96vw; }
.viewer-body { min-height: 160px; max-height: 68vh; overflow: auto; display: flex; align-items: center; justify-content: center; }
.viewer-media { max-width: 100%; max-height: 66vh; border-radius: 10px; display: block; }
.viewer-text {
  width: 100%; min-height: 46vh; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); padding: 14px; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.6; resize: vertical;
}
/* иконки файлов по типам */
.file-icon svg { width: 17px; height: 17px; }
.file-icon.img { background: rgba(110,190,140,.16); color: #6fd4a6; }
.file-icon.vid { background: rgba(240,119,119,.14); color: var(--red); }
.file-icon.aud { background: rgba(169,139,245,.16); color: #a98bf5; }
.file-icon.txt { background: rgba(124,140,248,.12); color: var(--text-dim); }

/* вид файлов: список и плитки, три размера */
#files-view-toggle button, #files-size-toggle button { padding: 6px 10px; font-size: 12px; }
.files-list.size-sm .file-icon { width: 24px; height: 24px; }
.files-list.size-sm .file-icon svg { width: 14px; height: 14px; }
.files-list.size-sm .file-row { padding: 6px 10px; }
.files-list.size-sm .file-name { font-size: 12.5px; }
.files-list.size-lg .file-icon { width: 40px; height: 40px; }
.files-list.size-lg .file-icon svg { width: 22px; height: 22px; }
.files-list.size-lg .file-row { padding: 14px 12px; }
.files-list.size-lg .file-name { font-size: 15px; }

.files-list.grid { display: grid; gap: 12px; }
.files-list.grid.size-sm { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.files-list.grid.size-md { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.files-list.grid.size-lg { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.files-list.grid .file-row {
  flex-direction: column; align-items: center; text-align: center; gap: 8px;
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 16px 10px;
}
.files-list.grid .file-row:hover { border-color: var(--blue); }
.files-list.grid .file-icon { width: 52px; height: 52px; border-radius: 14px; }
.files-list.grid .file-icon svg { width: 26px; height: 26px; }
.files-list.grid.size-lg .file-icon { width: 68px; height: 68px; }
.files-list.grid.size-lg .file-icon svg { width: 34px; height: 34px; }
.files-list.grid .file-name { flex: none; width: 100%; white-space: normal; word-break: break-word; max-height: 34px; overflow: hidden; }
.files-list.grid .file-meta { order: 3; }
.files-list.grid .file-acts { order: 4; opacity: 0; transition: opacity var(--t-fast) var(--ease-soft); }
.files-list.grid .file-row:hover .file-acts { opacity: 1; }

/* открытие кликом по всей карточке */
.file-row.openable { cursor: pointer; }
/* миниатюры вместо значков */
.file-icon.has-thumb { padding: 0; overflow: hidden; background: var(--bg-2); position: relative; }
.file-icon.has-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-icon .play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); color: #fff; font-size: 15px;
}
.files-list.grid .file-icon.has-thumb { border-radius: 12px; }
/* длинные имена: две строки и многоточие, без обрезки на полбуквы */
.files-list.grid .file-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; max-height: none; line-height: 1.35;
}

/* чипы-фильтры по метке аккаунта */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--text-dim);
  transition: background var(--t-fast) var(--ease-soft), color var(--t-fast) var(--ease-soft), border-color var(--t-fast) var(--ease-soft);
  user-select: none;
}
.chip:hover { border-color: var(--blue-dim); color: var(--text); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .cnt { opacity: .65; margin-left: 5px; font-size: 11px; }
.chip-row .hint { margin: 0; align-self: center; }

/* подсказка для новичка */
.onboarding { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; background: var(--panel-solid); }
.onb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-family: var(--display); font-size: 15px; }
.onb-close { cursor: pointer; color: var(--text-faint); font-size: 22px; line-height: 1; padding: 0 4px; transition: color var(--t-fast) var(--ease-soft); }
.onb-close:hover { color: var(--text); }
.onb-steps { display: flex; flex-direction: column; gap: 12px; }
.onb-step { display: flex; align-items: flex-start; gap: 12px; }
.onb-num { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--blue); color: #fff; }
.onb-title { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.onb-text { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.onb-done { margin-left: auto; color: var(--green); font-size: 16px; opacity: 0; flex-shrink: 0; }
.onb-step.done .onb-num { background: var(--green); }
.onb-step.done .onb-done { opacity: 1; }
.onb-step.done .onb-title { color: var(--text-dim); }

/* управление клиентами */
.admin-summary { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; font-size: 13px; color: var(--text-dim); }
.admin-summary b { color: var(--text); font-family: var(--mono); }
.user-card { border: 1px solid var(--border); border-radius: 13px; padding: 16px 18px; margin-bottom: 12px; background: var(--panel-solid); }
.user-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 10px; }
.user-login { font-weight: 650; font-size: 14.5px; }
.user-mail { font-size: 12px; color: var(--text-faint); font-family: var(--mono); }
.user-state { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.user-state.active { background: rgba(52,211,153,.14); color: var(--green); }
.user-state.grace { background: rgba(236,181,92,.16); color: var(--amber); }
.user-state.expired { background: rgba(240,119,119,.14); color: var(--red); }
.user-state.owner { background: rgba(124,140,248,.16); color: var(--blue); }
.user-state.blocked { background: rgba(240,119,119,.2); color: var(--red); }
.user-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px; }
.user-stats span b { color: var(--text); font-family: var(--mono); }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.user-actions select, .user-actions input { height: 32px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); }
.user-actions input { width: 74px; }
.user-actions .btn { padding: 7px 13px; font-size: 12.5px; }
