/* === Modern Dark Glass UI === */
:root {
    --primary: #22c55e;      /* Accent green */
    --primary-2: #0ea5e9;    /* Accent blue */
    --warning: #f59e0b;
    --danger: #ef4444;
    --muted: #94a3b8;

    --text: #e5e7eb;
    --text-d: #cbd5e1;
    --bg1: #0f172a;          /* slate-900 */
    --bg2: #111827;          /* gray-900 */
    --card-bg: rgba(255,255,255,.06);
    --card-bg-2: rgba(255,255,255,.03);
    --border: rgba(255,255,255,.08);

    --sidebar-width: 260px;
}

/* Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Inter", "Segoe UI", Roboto, Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(34,197,94,.12), transparent 60%),
        radial-gradient(1000px 600px at 120% 20%, rgba(14,165,233,.12), transparent 60%),
        linear-gradient(180deg, var(--bg1), var(--bg2));
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

/* App layout */
.app-container { display: flex; min-height: 100vh; }

/* Sidebar - glass sticky */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
    border-right: 1px solid var(--border);
    color: var(--text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    top: 0; left: 0;
    z-index: 10000;
    transform: translateZ(0);
    backdrop-filter: blur(6px);
}

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-2) 0%, var(--primary) 100%);
    box-shadow: inset 0 0 18px rgba(255,255,255,.22);
}
.sidebar-title {
    margin: 0; font-size: 18px; font-weight: 800;
}

.sidebar-menu { padding: 10px 0; }
.menu-item {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
    color: var(--text-d);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .2s, color .2s, border-color .2s, transform .1s;
}
.menu-item i { width: 20px; text-align: center; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(1px); }
.menu-item.active { background: rgba(255,255,255,.1); color: #111827; 
    border-left-color: var(--primary);
    background-image: linear-gradient(90deg, rgba(34,197,94,.25), rgba(255,255,255,0));
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
}
.menu-toggle {
    display: none; background: none; border: none; font-size: 1.5rem;
    color: var(--text); cursor: pointer; padding: .5rem; position: relative; z-index: 10001;
    -webkit-tap-highlight-color: transparent; user-select: none;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 18px;
    min-width: 0;
}

/* Header */
.header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    backdrop-filter: blur(6px);
}

/* Cards */
.card {
    background: rgba(17, 24, 39, 0.25) !important;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    backdrop-filter: blur(6px);
}
.card-header {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(34,197,94,.3);
    font-size: 1.05rem; font-weight: 800; color: var(--text);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}
.stat-card {
    border-radius: 16px; padding: 16px; color: #0b0b0b; font-weight: 700;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.stat-card i { opacity: .9; }
.stat-value { font-size: 1.9rem; margin: .35rem 0; }

/* Exchange banner */
.exchange-banner {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #0b0b0b; font-weight: 800;
    padding: .75rem 1rem; border-radius: 12px; margin-bottom: 12px;
}

/* Forms */
.form-group { margin-bottom: 12px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-d); font-size: .9rem; }
.form-control {
    width: 100%; padding: .75rem .85rem; border-radius: 12px;
    border: 1px solid var(--border); background: rgba(255,255,255,.04);
    color: var(--text);
    outline: none; transition: border .15s, box-shadow .15s, background .15s;
}
.form-control:focus {
    border-color: rgba(34,197,94,.6);
    background: rgba(255,255,255,.06);
    box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}

/* Buttons */
.btn {
    padding: .7rem 1.1rem; border: none; border-radius: 12px; cursor: pointer;
    font-size: .98rem; font-weight: 800; transition: transform .1s, box-shadow .2s, filter .15s;
}
.btn:active { transform: translateY(1px); filter: saturate(1.05); }
.btn-primary { background: var(--primary); color: #0b0b0b; box-shadow: 0 10px 24px rgba(34,197,94,.35); }
.btn-success { background: #16a34a; color: #0b0b0b; box-shadow: 0 8px 20px rgba(22,163,74,.35); }
.btn-danger  { background: #f59e0b; color: #0b0b0b; box-shadow: 0 8px 20px rgba(245,158,11,.35); }
.btn-secondary { background: rgba(255,255,255,.1); color: var(--text); border: 1px solid var(--border); }

/* Tables */
.table-container {
    overflow: auto;
    max-height: 420px;
    margin: 0 -2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.02);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.table-container::-webkit-scrollbar { height: 8px; width: 8px; }
.table-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 6px; }
.table-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }

table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: .92rem; color: var(--text); }
th, td { padding: .7rem .65rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: rgba(17,24,39,.88); backdrop-filter: blur(6px); font-weight: 700; }

/* Stack table on small screens */
.stack-on-mobile { min-width: auto !important; width: 100% !important; }
.stack-on-mobile thead { display: none; }
.stack-on-mobile tbody tr {
    display: block; margin-bottom: 10px; border: 1px solid var(--border);
    border-radius: 12px; background: rgba(255,255,255,.04); padding: .75rem;
}
.stack-on-mobile tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: .45rem .3rem; border: none; border-bottom: 1px dashed var(--border);
}
.stack-on-mobile tbody td:last-child { border-bottom: none; }
.stack-on-mobile tbody td:before {
    content: attr(data-label); font-weight: 700; text-transform: uppercase; font-size: .72rem; color: var(--muted); margin-right: .6rem;
}
@media (min-width: 600px) {
    .stack-on-mobile thead { display: table-header-group; }
    .stack-on-mobile tbody tr { display: table-row; background: transparent; border: none; padding: 0; }
    .stack-on-mobile tbody td { display: table-cell; border-bottom: 1px solid var(--border); }
    .stack-on-mobile tbody td:before { display: none; }
}

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: .92rem;
    border: 1px solid var(--border);
}
.alert-success { background: rgba(34,197,94,.12); color: #bbf7d0; border-left: 4px solid #16a34a; }
.alert-error   { background: rgba(239,68,68,.12); color: #fecaca; border-left: 4px solid #ef4444; }

/* Month navigation */
.month-navigation { display:flex; align-items:center; gap:.5rem; justify-content:center; flex-wrap:wrap; margin-bottom:12px; }
.month-title { font-size:1.1rem; font-weight:800; min-width:150px; text-align:center; }

/* Utilities */
.text-center { text-align:center; }
.text-right  { text-align:right; }
.mb-1 { margin-bottom:.5rem; }
.mb-2 { margin-bottom:1rem; }
.mt-1 { margin-top:.5rem; }
.mt-2 { margin-top:1rem; }

/* Focus */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}

/* Body horizontal scroll lock on mobile menu open */
body.no-scroll { overflow: hidden; }

/* Mobile */
@media (max-width: 900px) {
    .main-content { margin-left: 0; padding: 14px; }
    .menu-toggle { display: block; }
    .sidebar {
        transform: translateX(-100%); width: 280px;
        box-shadow: 14px 0 34px rgba(0,0,0,.45);
        transition: transform .28s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.visible { display: block; }
}

/* iOS touch improvements */
@supports (-webkit-touch-callout: none) {
    .table-container { -webkit-overflow-scrolling: touch; }
    .form-control { font-size: 16px; } /* prevent zoom on focus */
}
/* ===== iOS fix: убираем белый фон у сводных карточек ===== */
.stats-summary .summary-card,
.summary-card,
.stats-summary > .card,
.summary .card {
  /* Делает стеклянную, тёмную карточку */
  background: rgba(17, 24, 39, 0.35) !important;  /* тёмный прозрачный */
  background-color: rgba(17, 24, 39, 0.35) !important; /* дублируем для WebKit */
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #e5e7eb;
}

/* Заголовок и разделитель под тёмную тему */
.summary-card .summary-header {
  color: #e5e7eb !important;
  border-bottom: 2px solid rgba(34, 197, 94, 0.6) !important; /* зелёный */
}

/* Если хочешь полностью прозрачный фон — раскомментируй это:
.summary-card,
.stats-summary > .card {
  background: transparent !important;
  background-color: transparent !important;
}
*/
