:root {
    --primary: #2563eb; --primary-dark: #1d4ed8;
    --green: #16a34a; --green-bg: #dcfce7;
    --red: #dc2626; --red-bg: #fee2e2;
    --bg: #f1f5f9; --card: #fff; --text: #1e293b; --muted: #64748b; --border: #e2e8f0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
h2, h3 { margin: 0 0 12px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ---- Navbar ---- */
.navbar { background: #0f172a; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 60px; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { color: #cbd5e1; padding: 8px 14px; border-radius: 6px; }
.nav-links a:hover, .nav-links a.active { background: #1e293b; color: #fff; }
.nav-links a.logout { background: var(--red); color: #fff; margin-left: 8px; }
.nav-user { color: #94a3b8; margin: 0 8px; font-size: 14px; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }

.container { max-width: 1150px; margin: 24px auto; padding: 0 16px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }

/* ---- Buttons ---- */
.btn { display: inline-block; border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600; font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #e2e8f0; color: var(--text); } .btn-light:hover { background: #cbd5e1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-warn { background: #f59e0b; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; color: #334155; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
textarea { resize: vertical; margin-bottom: 10px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; cursor: pointer; }
label.check input { width: 17px; height: 17px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.rule-checks { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; max-height: 180px; overflow-y: auto; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; transition: opacity .5s; }
.alert-success { background: var(--green-bg); color: #166534; }
.alert-error { background: var(--red-bg); color: #991b1b; }

/* ---- Login ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.login-box { background: #fff; padding: 36px; border-radius: 14px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; }
.login-box form { text-align: left; }
.login-logo { font-size: 44px; }
.login-box h1 { font-size: 22px; margin: 6px 0; }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 22px; }

/* ---- Calendar ---- */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.cal-head h3 { margin: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-weight: 700; color: var(--muted); font-size: 13px; padding: 6px 0; }
.cal-day { min-height: 88px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; color: var(--text); background: #fff; transition: .15s; }
.cal-day:hover:not(.empty) { border-color: var(--primary); transform: translateY(-1px); }
.cal-day.empty { background: transparent; border: 0; }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.profit { background: var(--green-bg); border-color: #86efac; }
.cal-day.loss { background: var(--red-bg); border-color: #fca5a5; }
.cal-num { font-weight: 600; font-size: 13px; }
.cal-pnl { margin-top: auto; font-weight: 700; font-size: 15px; }
.cal-day.profit .cal-pnl { color: var(--green); } .cal-day.loss .cal-pnl { color: var(--red); }
.cal-cnt { font-size: 11px; color: var(--muted); }

/* ---- Modal ---- */
.modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.6); z-index: 50; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 12px; }
.modal.show { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 720px; }
.modal-box.small { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.modal-head h3 { margin: 0; }
.close { background: none; border: 0; font-size: 28px; cursor: pointer; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #f8fafc; font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.inline-edit { gap: 6px; } .inline-edit input { flex: 1; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: #dbeafe; color: var(--primary); }
.dt-row { display: flex; gap: 8px; }
.badge-red { background: var(--red-bg); color: var(--red); }

/* ---- Day view ---- */
.trade-top { display: flex; justify-content: space-between; align-items: center; }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.trade-grid div { background: #f8fafc; padding: 10px; border-radius: 8px; font-weight: 600; }
.trade-grid span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.rule-status { list-style: none; padding: 0; margin: 10px 0; }
.rule-status li { padding: 4px 0; font-size: 14px; }
.rule-status .ok { color: var(--green); } .rule-status .no { color: var(--red); }
.notes { background: #fffbeb; padding: 10px; border-radius: 8px; }
.shots { display: flex; gap: 14px; flex-wrap: wrap; }
.shots a { text-align: center; color: var(--muted); }
.shots img { display: block; width: 260px; max-width: 100%; height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ---- Mobile ---- */
@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #0f172a; flex-direction: column; align-items: stretch; padding: 10px; }
    .nav-links.open { display: flex; }
    .nav-links a.logout { margin: 6px 0 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .cal-day { min-height: 60px; padding: 4px; }
    .cal-pnl { font-size: 11px; } .cal-cnt { display: none; }
    .table { font-size: 13px; display: block; overflow-x: auto; }
}
