:root {
    --primary: #00bc01;
    --primary-dark: #009901;
    --navy: #00004e;
    --navy-light: #14145f;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f3f4f6;
    --panel: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --muted: #6b7280;
    --radius: 10px;
    --max-width: 1600px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--navy); border-bottom: 1px solid var(--navy-light); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; gap: 28px; padding: 14px 28px; }
.brand { display: flex; align-items: center; }
.brand-logo { height: 40px; display: block; }
.main-nav { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.main-nav a { color: #c7c7e0; font-weight: 600; font-size: 15px; }
.main-nav a:hover { color: #ffffff; text-decoration: none; }
.user-box { display: flex; align-items: center; gap: 12px; font-size: 15px; flex-wrap: wrap; }
.user-name { font-weight: 600; color: #ffffff; }
.logout-link { color: #c7c7e0; font-size: 14px; }
.logout-link:hover { color: #ffffff; }

.page-wrap { max-width: var(--max-width); margin: 0 auto; padding: 32px 28px 70px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.page-header h1 { margin: 0 0 6px; font-size: 30px; }
.page-header-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.flash { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 15px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; margin-bottom: 22px; }
.panel h2 { margin-top: 0; font-size: 21px; }
.panel h3 { font-size: 17px; margin-top: 0; }
.panel-success { background: #f0fdf4; border-color: #bbf7d0; }

.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.col-side .panel { padding: 20px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.margin-top { margin-top: 18px; }

.btn { display: inline-block; padding: 11px 20px; border-radius: 8px; border: none; font-weight: 600; font-size: 15px; cursor: pointer; transition: background .15s ease, transform .1s ease; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 13px; background: #e5e7eb; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

.inline-block { display: inline-block; margin: 0; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 620px; }
.stacked-form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=url], input[type=file], input[type=number], textarea, select {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 15px; font-family: inherit;
}
textarea { resize: vertical; }
.auth-box { max-width: 420px; margin: 70px auto; background: var(--panel); padding: 36px; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,78,.08); }
.auth-box h2 { margin-top: 0; }
.auth-box form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.auth-box label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
.auth-box input[type=text], .auth-box input[type=password] { padding: 13px 14px; font-size: 16px; }
.btn-auth {
    display: block;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,188,1,.35);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-auth:hover { filter: brightness(1.06); box-shadow: 0 8px 22px rgba(0,188,1,.45); transform: translateY(-1px); }
.btn-auth:active { transform: translateY(0) scale(.98); }
.master-logo { display: block; margin: 0 auto 22px; padding: 20px 26px; background: var(--navy); border-radius: var(--radius); }
.master-logo img { display: block; height: 64px; margin: 0 auto; }
.accent { color: var(--primary); }

.role-badge { padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.role-qa { background: #dbeafe; color: #1e40af; }
.role-business { background: #fef3c7; color: #92400e; }
.role-devops { background: #d1fae5; color: #065f46; }
.role-developer { background: #fce7f3; color: #9d174d; }
.small-badge { font-size: 10px; padding: 1px 6px; }

.badge-active { color: var(--success); font-weight: 600; font-size: 13px; }
.badge-inactive { color: var(--danger); font-weight: 600; font-size: 13px; }

.env-chip { padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 12px; }
.env-FEATURE { background: #e0e7ff; color: #3730a3; }
.env-E2E { background: #fae8ff; color: #86198f; }
.env-UAT { background: #ffedd5; color: #9a3412; }
.env-PRODUCTION { background: #dcfce7; color: #166534; }
.round-chip { background: #f3f4f6; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; color: var(--muted); }

.status-banner { padding: 12px 16px; border-radius: var(--radius); background: #eef2ff; color: #3730a3; margin-bottom: 20px; }
.status-DONE { background: #dcfce7; color: #166534; }
.status-REJECTED { background: #fee2e2; color: #991b1b; }
.status-DEMO_SENT, .status-BUSINESS_APPROVED { background: #fef3c7; color: #92400e; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.feature-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: block; color: var(--text); transition: box-shadow .15s, transform .15s; }
.feature-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); text-decoration: none; transform: translateY(-1px); }
.feature-card-top { display: flex; justify-content: space-between; margin-bottom: 10px; }
.feature-card h3 { margin: 6px 0; font-size: 17px; }
.status-line { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.feature-card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--panel); border-radius: var(--radius); border: 1px dashed var(--border); }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 16px; }
.check-btn { width: 26px; height: 26px; border-radius: 6px; border: 2px solid var(--border); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; padding: 0; }
.check-btn.checked { background: var(--success); border-color: var(--success); }

.checklist, .testcase-list, .bug-list, .comment-list, .mini-list { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: none; }
.checked-text { text-decoration: line-through; color: var(--muted); }
.tag-mini { background: #f3f4f6; color: var(--muted); font-size: 10px; padding: 1px 6px; border-radius: 10px; }

.testcase-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.testcase-list li:last-child { border-bottom: none; }

.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.progress-bar { flex: 1; height: 8px; background: #f3f4f6; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--success); }

.bug-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.bug-item:last-child { border-bottom: none; }
.bug-status-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #f3f4f6; color: var(--muted); margin-left: 8px; }
.bug-open .bug-status-tag, .bug-retest_failed .bug-status-tag { background: #fee2e2; color: #991b1b; }
.bug-fixed .bug-status-tag { background: #fef3c7; color: #92400e; }
.bug-closed .bug-status-tag { background: #dcfce7; color: #166534; }
.bug-status-form select { font-size: 12px; padding: 4px 6px; }

.comment-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-list li:last-child { border-bottom: none; }
.comment-list p { margin: 6px 0 0; }
.comment-head { display: flex; gap: 8px; align-items: center; }

.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-list li:last-child { border-bottom: none; }
.approval-tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 700; }
.approval-tag.ok { background: #dcfce7; color: #166534; }
.approval-tag.no { background: #fee2e2; color: #991b1b; }

.demo-screenshot { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin: 10px 0; }

.add-details { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 14px; }
.add-details summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: 14px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th, .data-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 20px 28px; text-align: center; }
.site-footer-inner { max-width: var(--max-width); margin: 0 auto; font-size: 14px; color: var(--muted); }
.site-footer-inner strong { color: var(--text); }

/* Dashboard stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; }
.stat-num { font-size: 34px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 8px; }
.stat-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat-testing .stat-num { color: #d97706; }
.stat-done .stat-num { color: #16a34a; }
.stat-rejected .stat-num { color: #dc2626; }
.stat-bugs .stat-num { color: #dc2626; }

.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 28px; align-items: start; }
.chart-panel h3 { margin-bottom: 16px; }

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 30px; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: #f3f4f6; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--primary); min-width: 4px; transition: width .3s ease; }
.bar-count { text-align: right; font-weight: 700; color: var(--text); }

.status-fill-NEW, .status-fill-PREP { background: #9ca3af; }
.status-fill-TESTING { background: #4f46e5; }
.status-fill-QA_APPROVED { background: #0891b2; }
.status-fill-DEMO_SENT { background: #d97706; }
.status-fill-REJECTED { background: #dc2626; }
.status-fill-BUSINESS_APPROVED { background: #ca8a04; }
.status-fill-QA_FINAL_APPROVED { background: #7c3aed; }
.status-fill-DONE { background: #16a34a; }

.env-fill-FEATURE { background: #4f46e5; }
.env-fill-E2E { background: #a21caf; }
.env-fill-UAT { background: #d97706; }
.env-fill-PRODUCTION { background: #16a34a; }

.donut-row { display: flex; align-items: center; gap: 20px; }
.donut-chart { width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0; }
.donut-legend { list-style: none; padding: 0; margin: 0; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* Language switcher */
.lang-switch { font-weight: 700; font-size: 14px; padding: 6px 14px; border: 1px solid var(--navy-light); border-radius: 20px; color: #ffffff; background: var(--navy-light); }
.lang-switch:hover { background: var(--primary); border-color: var(--primary); text-decoration: none; }
.anon-lang-switch { text-align: end; max-width: var(--max-width); margin: 0 auto; padding: 18px 28px 0; }
.anon-lang-switch a { font-weight: 700; font-size: 14px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px; color: var(--primary); }

/* ============================================================
   RTL (Arabic) support
   ============================================================ */
html[dir="rtl"] body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
html[dir="rtl"] .checklist li,
html[dir="rtl"] .bug-item,
html[dir="rtl"] .comment-head,
html[dir="rtl"] .bar-row,
html[dir="rtl"] .donut-row { direction: rtl; }
html[dir="rtl"] .legend-dot { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .role-badge,
html[dir="rtl"] .env-chip,
html[dir="rtl"] .round-chip { direction: rtl; }
html[dir="rtl"] .bar-row { grid-template-columns: 30px 1fr 130px; }
html[dir="rtl"] .bar-count { text-align: left; }
html[dir="rtl"] .checked-text { text-decoration-line: line-through; }
html[dir="rtl"] .btn-row,
html[dir="rtl"] .inline-form,
html[dir="rtl"] .page-header-actions,
html[dir="rtl"] .feature-card-meta,
html[dir="rtl"] .main-nav,
html[dir="rtl"] .user-box { direction: rtl; }

/* ============================================================
   Responsive breakpoints
   ============================================================ */

/* Extra-large desktops (1920x1080 and up): use a bit more width */
@media (min-width: 1800px) {
    :root { --max-width: 1760px; }
    body { font-size: 16px; }
    .page-header h1 { font-size: 32px; }
    .stat-num { font-size: 38px; }
}

/* Small laptops / tablets landscape */
@media (max-width: 1024px) {
    .two-col { grid-template-columns: 1fr; }
    .page-wrap { padding: 24px 20px 60px; }
    .topbar-inner { padding: 12px 20px; }
}

/* Tablets portrait / large phones */
@media (max-width: 768px) {
    :root { --radius: 10px; }
    .topbar-inner { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
    .main-nav { order: 3; width: 100%; gap: 14px; font-size: 14px; }
    .user-box { margin-inline-start: auto; }
    .page-wrap { padding: 20px 16px 50px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header h1 { font-size: 24px; }
    .panel { padding: 18px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 90px 1fr 26px; font-size: 11px; }
    html[dir="rtl"] .bar-row { grid-template-columns: 26px 1fr 90px; }
    .feature-grid { grid-template-columns: 1fr; }
    .data-table { display: block; overflow-x: auto; white-space: nowrap; }
    .auth-box { margin: 30px auto; max-width: calc(100% - 32px); padding: 26px; }
    .donut-row { flex-direction: column; align-items: flex-start; }
}

/* Phones */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-num { font-size: 26px; }
    .btn { padding: 10px 16px; font-size: 14px; }
    .master-logo img { height: 48px; }
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form input, .inline-form select { width: 100%; }
    .btn-row { flex-direction: column; }
    .btn-row .btn { width: 100%; text-align: center; }
}
