/* The Power Portal — shared styles. Colours and fonts follow www.edanpower.co.uk (electric blue
   #2E11DE, deep navy #0A0142, green #7FC61D, Poppins + Montserrat) with the Power Portal logo. */
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/poppins-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/poppins-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/poppins-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/poppins-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Montserrat; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/montserrat-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); }

:root {
    /* Brand: Edan Power website colours. Swap these to change the whole look. */
    --navy: #2e11de; --navy-2: #2410b8; --navy-3: #0a0142;   /* primary buttons, active items, dark accents */
    --brand-green: #7fc61d; --brand-green-2: #2e8b2e;        /* green highlights and "go" actions */
    --accent: #2e11de; --accent-soft: #eeebfd;               /* links, selected menu items */
    --bg: #f5f7fb; --card: #ffffff; --text: #0f172a; --text-2: #334155; --muted: #64748b;
    --line: #e2e8f0; --line-2: #f1f5f9;
    --danger: #dc2626; --ok: #059669; --warn: #d97706;
    --radius: 12px; --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
    --font: Poppins, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --appbar-h: 60px; --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; color: var(--text); letter-spacing: -.01em; }
h1, .page-title { font-family: Montserrat, var(--font); }
h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.center { text-align: center; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* App bar (navy, as in the live CRM) */
.appbar { position: fixed; inset: 0 0 auto 0; height: var(--appbar-h); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: #fff; color: var(--navy); border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--navy), var(--brand-green)) 1; box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.brand-logo { height: 38px; width: auto; display: block; }
.appbar-spacer { flex: 1; }
.appbar-help { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--navy); font-weight: 600; font-size: 13px; }
.appbar-help:hover { background: var(--accent-soft); text-decoration: none; }
@media (max-width: 640px) { .appbar-help span { display: none; } }
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-dark { color: var(--navy); }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #ff9a2e, #ff7a00); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(255, 122, 0, .35); }
.menu-toggle { display: none; background: none; border: 0; color: var(--navy); cursor: pointer; padding: 6px; border-radius: 8px; }
.menu-toggle .icon { width: 22px; height: 22px; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: 10px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { background: var(--line-2); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 600; }
.usermenu-name { display: flex; flex-direction: column; line-height: 1.2; font-weight: 500; }
.usermenu-name small { color: var(--muted); font-weight: 400; font-size: 12px; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; border: 1px solid var(--line); }
.usermenu-panel a, .usermenu-panel button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--line-2); text-decoration: none; }

/* Sidebar (white with grouped sections) */
.shell { display: flex; min-height: 100vh; padding-top: var(--appbar-h); }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); position: fixed; top: var(--appbar-h); bottom: 0; left: 0; overflow-y: auto; padding: 14px 10px 30px; z-index: 20; }
.sidebar nav { display: grid; gap: 2px; }
.nav-single, .nav-group summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; cursor: pointer; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-single:hover, .nav-group summary:hover { background: var(--line-2); text-decoration: none; }
.nav-single.active { background: var(--accent-soft); color: var(--accent); }
.nav-group summary .chev { margin-left: auto; width: 14px; height: 14px; color: #94a3b8; transition: transform .15s; }
.nav-group[open] summary .chev { transform: rotate(90deg); }
.nav-group a { display: block; padding: 7px 12px 7px 40px; margin: 1px 0; border-radius: 8px; color: var(--muted); font-size: 13.5px; }
.nav-group a:hover { background: var(--line-2); color: var(--text); text-decoration: none; }
.nav-group a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.page-head { padding: 22px 28px 0; }
.page-title { font-size: 21px; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 16px 28px 48px; }

/* Cards and dashboard */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
details.card summary { cursor: pointer; font-weight: 600; color: var(--text); }
details.card[open] summary { margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { display: block; margin: 0; position: relative; overflow: hidden; color: var(--text); transition: transform .12s, box-shadow .12s; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.stat:nth-child(4n+2)::before { background: #0ea5e9; }
.stat:nth-child(4n+3)::before { background: #10b981; }
.stat:nth-child(4n+4)::before { background: #f59e0b; }
.stat:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -.02em; margin: 4px 0; }
.stat-sub { color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid-2 .card { margin: 0; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; color: var(--text-2); }
.bar-row:hover { text-decoration: none; color: var(--text); }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, var(--accent), var(--brand-green)); border-radius: 4px; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.list-row { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line-2); color: var(--text); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { text-decoration: none; background: #fafbfe; }

/* Buttons and pills */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { text-decoration: none; border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(46, 17, 222, .3); }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-block { width: 100%; }
.btn.disabled { opacity: .45; pointer-events: none; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--line-2); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-green { background: #ecfdf5; color: #047857; }
.pill-red { background: #fef2f2; color: #b91c1c; }
.pill-amber { background: #fffbeb; color: #b45309; }
.pill-blue { background: #eff6ff; color: #1d4ed8; }
.pill-grey { background: var(--line-2); color: var(--text-2); }

/* Toolbars, forms, tables */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 16px; align-items: center; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar form { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
input, select, textarea { font: inherit; padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); background: #fff; color: var(--text); width: 100%; transition: border-color .12s, box-shadow .12s; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 260px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 17, 222, .15); }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table th { background: #f8fafc; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); }
.table th a { color: var(--muted); }
.table td a { font-weight: 500; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #f8faff; cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.pager-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pager { display: flex; gap: 10px; align-items: center; }
.flash { padding: 11px 15px; border-radius: var(--radius-sm); background: #ecfdf5; color: #065f46; margin-bottom: 16px; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash ul { margin: 6px 0 0 18px; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field-wide { grid-column: 1 / -1; }
.field .check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--text); font-size: 14px; }
.field .check input { width: auto; }
.req { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.lookup { position: relative; }
.lookup-clear { position: absolute; right: 8px; top: 7px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; }
.lookup-results { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; display: none; }
.lookup-results.open { display: block; }
.lookup-results button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer; font: inherit; }
.lookup-results button:hover, .lookup-results button:focus { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 13px; }
.chip-remove { border: 0; background: none; cursor: pointer; color: #6366f1; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; margin: 0; }
.details-stack { grid-template-columns: 1fr; }
.details dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.details dd { margin: 2px 0 0; word-break: break-word; color: var(--text); }
.note-form { display: grid; gap: 8px; margin-bottom: 14px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.notes li { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; }
.note-meta { font-size: 12px; color: var(--muted); }
.note-body { white-space: pre-wrap; }
.doc-list { margin: 0; padding-left: 18px; }
.json { white-space: pre-wrap; word-break: break-word; font-size: 12px; margin: 0; }

/* Boards and calendar */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { flex: 0 0 264px; background: #eef2f7; border-radius: var(--radius); padding: 12px; }
.kanban-col header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--text); margin-bottom: 10px; font-size: 13px; }
.kanban-card { display: block; background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.kanban-card:hover { text-decoration: none; border-color: #a5b4fc; transform: translateY(-1px); }
.kanban-card span { display: block; font-size: 12px; }
.kanban-more { font-size: 12px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; }
.cal-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); min-height: 170px; padding: 10px; box-shadow: var(--shadow); }
.cal-day header { font-weight: 600; color: var(--text); margin-bottom: 8px; }
.cal-item { display: block; font-size: 12px; padding: 7px 8px; margin-bottom: 6px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }
.cal-item span { display: block; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 85% 0%, #2e11de 0%, #1a0a8a 45%, #0a0142 100%); padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; display: grid; gap: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card h1 { font-size: 22px; margin: 0; }
.login-card label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }

@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
    .sidebar { left: calc(-1 * var(--sidebar-w)); transition: left .2s; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .page-head { padding: 18px 16px 0; }
    .content { padding: 14px 16px 40px; }
    .usermenu-name { display: none; }
    .brand-name { display: none; }
    .filters input[type=search] { min-width: 0; width: 100%; }
}

/* Tables inside side panels wrap instead of overflowing */
aside .table th, aside .table td, .detail-layout aside .table td { white-space: normal; padding: 9px 10px; }
.toolbar-actions .pill { align-self: center; }

/* Named groups of one list (e.g. suppliers) */
.segments { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.segment { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); text-decoration: none; font-size: .9rem; }
.segment:hover { border-color: var(--navy-2); }
.segment.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.brand-logo-lg { height: 52px; margin: 0 auto 8px; }
/* Tables whose cells hold long text or web addresses: wrap instead of widening the page. */
.table-wrap td { white-space: normal; overflow-wrap: anywhere; }
p > code, li > code, td > code { overflow-wrap: anywhere; word-break: break-word; }
