/* MCOM F2 - tema stile M4 (scritto da zero, nessun file Kolmisoft).
   Caricato DOPO app.css: ridefinisce aspetto e layout, mantiene i nomi delle classi.
   Rollback: togliere il link a questo file in app/layout.php. */

@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300; font-display: swap;
    src: url("fonts/open-sans-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap;
    src: url("fonts/open-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap;
    src: url("fonts/open-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("fonts/open-sans-latin-700-normal.woff2") format("woff2"); }

:root {
    --m4-navy: #012a6a;
    --m4-navy-dark: #011f50;
    --m4-page: #e6e9eb;
    --m4-text: #565759;
    --m4-cell: #323537;
    --m4-head-bg: #e6e9ee;
    --m4-head-text: #5e6469;
    --m4-border: #d7dce4;
    --m4-row-alt: #f3f5f8;
    --m4-muted: #8a9096;
    --m4-link: #0b4ea2;
}

/* ---------- base ---------- */
html, body {
    font-family: "Open Sans", Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: var(--m4-text);
    background: var(--m4-page);
}
body { min-height: 100vh; }
a { color: var(--m4-link); }
.app-shell { display: block; min-height: 100vh; }
.main { background: var(--m4-page); color: var(--m4-text); display: flex; flex-direction: column; min-height: 100vh; }
.content { background: var(--m4-page); padding: 14px 16px 24px; flex: 1 0 auto; }
.muted, .field-help, .numbering-muted, .section-description { color: var(--m4-muted); }

/* ---------- header ---------- */
.m4-header { background: var(--m4-navy); color: #fff; height: 55px; position: relative; z-index: 50; }
.m4-top { height: 66px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 24px; }
.m4-brand { display: flex; align-items: baseline; gap: 8px; color: #fff; text-decoration: none; justify-self: start; white-space: nowrap; }
.m4-brand img { height: 26px; align-self: center; background: #fff; border-radius: 3px; padding: 2px 4px; }
.m4-brand strong { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.m4-brand small { font-size: 11px; color: #b9c4d6; }
.m4-top-right { display: flex; align-items: center; gap: 18px; font-size: 13px; justify-self: end; }
.m4-account { position: relative; }
.m4-account > button { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; padding: 6px 0; }
.m4-account > button::after { content: ""; display: inline-block; margin-left: 6px; width: 6px; height: 6px;
    border-right: 1px solid #fff; border-bottom: 1px solid #fff; transform: rotate(45deg) translateY(-3px); }
.m4-account-menu { display: none; position: absolute; right: 0; top: 100%; min-width: 170px; background: var(--m4-navy);
    padding: 6px 0 10px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.m4-account:hover .m4-account-menu, .m4-account:focus-within .m4-account-menu, .m4-account.open .m4-account-menu { display: block; }
.m4-account-menu button, .m4-account-menu a { display: block; width: 100%; text-align: left; background: none; border: 0;
    color: #fff; font: inherit; padding: 6px 16px; cursor: pointer; text-decoration: none; }
.m4-account-menu button:hover, .m4-account-menu a:hover { background: var(--m4-navy-dark); }

/* language flags inside the blue header */
.m4-top .language-flag-current { width: 30px; height: 22px; border-radius: 2px; border: 1px solid rgba(255,255,255,.45);
    background: transparent; box-shadow: none; padding: 0; overflow: hidden; }
.m4-top .language-flag-current .language-flag-icon, .m4-top .language-flag-option .language-flag-icon { width: 24px; height: 16px; }
.m4-top .language-flag-menu { z-index: 60; border-radius: 0; background: var(--m4-navy); border-color: var(--m4-navy-dark); }
.m4-top .language-flag-option { width: 34px; height: 26px; border-radius: 2px; background: transparent; border-color: transparent; }
.m4-top .language-flag-option.is-active, .m4-top .language-flag-option:hover { background: var(--m4-navy-dark); border-color: rgba(255,255,255,.4); }

/* ---------- main menu (3 levels) ---------- */
.m4-nav { height: 66px; display: flex; justify-content: center; }
.m4-nav ul { list-style: none; margin: 0; padding: 0; }
.m4-nav > ul { display: flex; gap: 2px; }
.m4-nav > ul > li { position: relative; }
.m4-nav > ul > li > a { display: flex; align-items: center; gap: 7px; height: 66px; padding: 0 13px; color: #cccccc;
    font-size: 14px; text-transform: uppercase; letter-spacing: .2px; text-decoration: none; position: relative; }
.m4-nav > ul > li > a svg { width: 17px; height: 17px; fill: currentColor; opacity: .9; }
.m4-nav > ul > li:hover > a, .m4-nav > ul > li.active > a, .m4-nav > ul > li.open > a { color: #fff; }
.m4-nav > ul > li.active > a::after { content: ""; position: absolute; left: 50%; bottom: 0; margin-left: -6px;
    border: 6px solid transparent; border-bottom-color: #fff; }
.m4-nav li ul { display: none; position: absolute; min-width: 185px; background: var(--m4-navy); padding: 7px 0 15px;
    box-shadow: 0 8px 18px rgba(0,0,0,.22); }
.m4-nav > ul > li > ul { top: 66px; left: 0; }
.m4-nav li li { position: relative; }
.m4-nav li li > a { display: flex; justify-content: space-between; align-items: center; padding: 5px 16px; color: #fff;
    font-size: 13px; text-decoration: none; white-space: nowrap; }
.m4-nav li li > a:hover, .m4-nav li li.active > a { background: var(--m4-navy-dark); }
.m4-nav li li.has-sub > a::after { content: "\25B6"; font-size: 8px; margin-left: 14px; opacity: .8; }
.m4-nav li li > ul { top: -7px; left: 100%; }
.m4-nav li:hover > ul, .m4-nav li:focus-within > ul, .m4-nav li.open > ul { display: block; }

/* ---------- breadcrumb bar ---------- */
.m4-crumbs { background: #fff; height: 47px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; border-bottom: 1px solid var(--m4-border); }
.m4-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px;
    font-size: 21px; font-weight: 300; color: #a3a9ae; white-space: nowrap; overflow: hidden; }
.m4-crumbs li + li::before { content: "\203A"; margin-right: 10px; color: #a3a9ae; }
.m4-crumbs li:last-child { color: #3f4448; overflow: hidden; text-overflow: ellipsis; }
.m4-crumbs a { color: inherit; text-decoration: none; }
.m4-crumbs-actions { display: flex; gap: 8px; }

/* ---------- headings and panels ---------- */
.page-heading { margin: 4px 0 12px; align-items: flex-end; }
.page-heading h2 { font-size: 18px; font-weight: 600; color: #3f4448; margin: 2px 0; }
.page-heading p { color: var(--m4-muted); margin: 2px 0 0; }
.eyebrow { color: var(--m4-muted); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }
.panel, .metric-card, .welcome-panel, .summary-card, .customer-service-card, .toggle-card, .pbx-toggle,
.section-tabs, .sticky-save-bar {
    background: #fff; border: 1px solid var(--m4-border); border-radius: 0; box-shadow: none; color: var(--m4-text);
}
.panel { padding: 0 0 12px; margin-bottom: 14px; }
.panel > :not(.panel-title):not(.table-responsive):not(.data-table):not(.customer-service-panel-head):not(.customer-queue-head):not(.pbx-panel-header):not(.processor-node-header) { margin-left: 14px; margin-right: 14px; }
.panel-title, .pbx-panel-header, .customer-service-panel-head, .processor-node-header {
    background: #f3f5f8; border-bottom: 1px solid var(--m4-border); color: #2f3336;
}
.panel-title { font-size: 15px; font-weight: 700; padding: 10px 14px; margin: 0 0 12px; }
.welcome-panel h2, .metric-card strong, .summary-card strong, .toggle-card strong, .pbx-toggle strong,
.customer-service-card strong, .table-main-link, .customer-services-head h3 { color: #2f3336; }
.summary-card { padding: 10px 14px; }
.summary-card span, .metric-card span, .metric-card small { color: var(--m4-muted); text-transform: uppercase; font-size: 11px; }
.summary-card strong { font-size: 20px; font-weight: 600; }

/* ---------- tables ---------- */
.table-responsive { margin: 0; }
.data-table { border-collapse: collapse; width: 100%; color: var(--m4-cell); font-size: 12px; }
.data-table th { background: var(--m4-head-bg); color: var(--m4-head-text); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .2px; border-top: 1px solid var(--m4-border);
    border-bottom: 1px solid var(--m4-border); padding: 7px 10px; text-align: left; white-space: nowrap; }
.data-table td { border-bottom: 0; padding: 5px 10px; height: 24px; vertical-align: middle; }
.data-table tbody tr:nth-child(even) td { background: var(--m4-row-alt); }
.data-table tbody tr:hover td { background: #e9eef5; }
.data-table td small { color: var(--m4-muted); display: block; }
.data-table code { color: #1d3f73; background: #eef2f7; border-radius: 2px; }
.empty-table { color: var(--m4-muted); text-align: center; padding: 14px; }
.table-actions { white-space: nowrap; text-align: right; }

/* ---------- buttons (M4: grigio chiaro, maiuscolo) ---------- */
.btn, .primary-button, .logout-button {
    border-radius: 2px; border: 1px solid #c8ced6; background: #e6e9ee; color: #3f4448; font-family: inherit;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; padding: 6px 12px;
    box-shadow: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { background: #dce1e8; }
.btn-primary, .primary-button { background: var(--m4-navy); border-color: var(--m4-navy); color: #fff; }
.btn-primary:hover, .primary-button:hover { background: var(--m4-navy-dark); }
.btn-secondary { background: #5e6469; border-color: #5e6469; color: #fff; }
.btn-light { background: #f3f5f8; border-color: #d7dce4; color: #3f4448; }
.btn-success { background: #e3f1e6; border-color: #b9dcc1; color: #24683a; }
.btn-warning { background: #fbf0dc; border-color: #ecd3a5; color: #8a5a0b; }
.btn-danger-soft { background: #f8e3e3; border-color: #e8bcbc; color: #a32626; }
.btn-small { padding: 3px 8px; font-size: 10px; }

/* ---------- badges (M4: grigi, maiuscoli) ---------- */
.badge { border-radius: 2px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
    padding: 2px 6px; background: #e6e9ee; color: #4d5358; }
.badge-gray { background: #e6e9ee; color: #4d5358; }
.badge-green { background: #dcefe1; color: #24683a; }
.badge-red { background: #f6dede; color: #a32626; }
.badge-orange { background: #f9ecd6; color: #8a5a0b; }
.badge-blue { background: #dde7f5; color: #1d3f73; }
.badge-purple { background: #e7e2f3; color: #4f3a8a; }

/* ---------- forms ---------- */
.filter-bar { border-bottom: 1px solid var(--m4-border); padding: 10px 14px; margin: 0 0 4px; }
.filter-bar label, .field label { color: #4d5358; font-size: 12px; font-weight: 600; }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea,
.pbx-inline-add select, .mcom-switch-row, .pbx-codec-row input[type="number"], .login-card input {
    border: 1px solid #c3c9d0; border-radius: 0; background: #fff; color: var(--m4-cell);
    font-family: inherit; font-size: 13px; box-shadow: none;
}
.filter-bar input, .filter-bar select, .field input, .field select { min-height: 28px; height: 28px; padding: 3px 7px; }
.field textarea { padding: 5px 7px; }
.filter-bar label, .field label { margin-bottom: 3px; }
.filter-bar input:focus, .filter-bar select:focus, .field input:focus, .field select:focus, .field textarea:focus,
.login-card input:focus { border-color: var(--m4-navy); box-shadow: 0 0 0 2px rgba(1, 42, 106, .12); outline: none; }
.trunk-section, .billing-section { border-bottom: 1px solid var(--m4-border); }
.trunk-section h3, .billing-section h3 { font-size: 13px; font-weight: 700; color: #2f3336;
    border-bottom: 1px solid #3f4448; padding-bottom: 4px; }
.switch-line, .toggle-card, .pbx-toggle, .pbx-codec-row, .numbering-pre, .customer-services-next {
    border-radius: 0; background: #f7f8fa; }
.section-tabs a { border-radius: 0; color: #4d5358; }
.section-tabs a:hover { background: #eef2f7; color: var(--m4-navy); }
.alert-success { border-radius: 0; background: #e8f4ea; border-color: #b9dcc1; color: #24683a; }
.alert-error-list, .alert-error { border-radius: 0; background: #fbeaea; border-color: #e8bcbc; color: #a32626; }
.numbering-info-box { border-radius: 0; background: #eef2f7; border-color: #c9d6ea; color: #1d3f73; }
.pbx-credential-box { border-radius: 0; }
.pagination a { border-radius: 0; background: #f3f5f8; color: #3f4448; }
.pagination a.active { background: var(--m4-navy); color: #fff; }
.back-link { color: var(--m4-link); }

/* ---------- footer ---------- */
.m4-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: #fff;
    border-top: 1px solid var(--m4-border); padding: 8px 18px; font-size: 12px; color: var(--m4-muted); }
.m4-footer .m4-live a { color: var(--m4-text); text-decoration: none; margin-right: 12px; }
.m4-footer .m4-live strong { color: #2f3336; }
.m4-footer .m4-copy { text-align: center; }
.m4-footer .m4-clock { text-align: right; }

/* ---------- login ---------- */
.login-body { background: var(--m4-navy); }
.login-card { background: #fff; border: 0; border-radius: 0; box-shadow: 0 10px 40px rgba(0,0,0,.35); color: var(--m4-text); }
.login-card h1 { color: #2f3336; }
.login-card > p, .login-card label, .login-footer { color: var(--m4-muted); }
.login-card .primary-button { width: 100%; justify-content: center; padding: 9px 12px; font-size: 12px; }

@media (max-width: 1100px) {
    .m4-top { grid-template-columns: auto 1fr auto; padding: 0 12px; }
    .m4-nav > ul > li > a { padding: 0 7px; font-size: 13px; }
    .m4-nav > ul > li > a svg { display: none; }
    .m4-brand small { display: none; }
}

@media (max-width: 900px) {
    .m4-header { height: auto; }
    .m4-top { height: auto; grid-template-columns: 1fr auto; padding: 6px 10px; }
    .m4-nav { grid-column: 1 / -1; grid-row: 2; height: 40px; overflow-x: auto; justify-content: flex-start; }
    .m4-nav > ul > li > a { height: 40px; padding: 0 8px; }
    .m4-nav > ul > li > ul { top: 40px; }
    .m4-crumbs ol { font-size: 17px; }
    .m4-brand { white-space: nowrap; }
    .m4-brand small { display: none; }
}

/* ---------- F2e: riquadri a scomparsa (come M4) ---------- */
.m4-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; user-select: none; }
.m4-toggle { margin-left: auto; flex: 0 0 auto; background: none; border: 0; color: var(--m4-link); font-family: inherit;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; cursor: pointer; padding: 2px 4px; }
.m4-toggle::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; vertical-align: 2px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-135deg); }
.m4-collapsed .m4-toggle::after { transform: rotate(45deg); vertical-align: 4px; }
.panel.m4-collapsed { padding-bottom: 0; }
.panel.m4-collapsed > :not(.m4-panel-head) { display: none !important; }
.panel.m4-collapsed > .m4-panel-head { margin-bottom: 0; border-bottom: 0; }
.m4-crumbs-actions .btn { font-size: 11px; }

/* F2e: intestazioni composte (scheda Cliente: Extensions, Ring Groups, DIDs, Queues, SIP Trunks) */
.customer-service-panel-head, .customer-queue-head { margin: 0 0 10px; padding: 10px 14px; background: #f3f5f8;
    border-bottom: 1px solid var(--m4-border); }
.customer-service-panel-head .panel-title, .customer-queue-head .panel-title,
.pbx-panel-header .panel-title, .processor-node-header .panel-title { background: none; border: 0; padding: 0; margin: 0 0 2px; }
.customer-service-panel-head p, .customer-queue-head p { color: var(--m4-muted); margin: 0; }
.m4-companion-hidden { display: none !important; }

/* F2g: "Tieni aperto" (puntina) accanto ad Apri/Chiudi; scelta ricordata nel browser */
.m4-pin { margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; background: none;
    border: 1px solid transparent; border-radius: 2px; color: var(--m4-muted); font-family: inherit; font-size: 10px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .3px; padding: 2px 7px; cursor: pointer; }
.m4-pin svg { width: 12px; height: 12px; fill: currentColor; transform: rotate(0deg); }
.m4-pin:hover { color: var(--m4-navy); border-color: #c9d6ea; }
.m4-pin[aria-pressed="true"] { color: var(--m4-navy); background: #e3eaf5; border-color: #b9c9e3; }
.m4-pin[hidden] { display: none; }
.m4-pin + .m4-toggle { margin-left: 10px; }
.m4-pin[hidden] + .m4-toggle { margin-left: auto; }
/* F2g: i pulsanti "Apri tutto/Chiudi tutto" nascosti (pagine senza riquadri richiudibili) non devono apparire */
.m4-crumbs-actions [hidden], .btn[hidden] { display: none !important; }
