/* ─── FIRMATTO · shared/style.css ─────────────────────────────────────────── */
:root {
    --bg-deep:    #0d0d1a;
    --bg-dark:    #0f2040;
    --bg-mid:     #1a3a6e;
    --accent:     #e94560;
    --accent-dk:  #c73652;
    --white:      #ffffff;
    --surface:    #ffffff;
    --surface-2:  #f0f2f6;
    --surface-3:  #fafbfd;
    --border:     #e2e6f0;
    --text:       #1a1f30;
    --text-2:     #5a6070;
    --text-3:     #aab0bf;
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  22px;
    --r-xl:  28px;
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.12);
    --shadow-lg:  0 20px 60px rgba(0,0,0,0.18);
    --shadow-dark: 0 25px 70px rgba(0,0,0,0.45);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Segoe UI', system-ui, sans-serif; color: var(--text); background: var(--surface-2); }
a { text-decoration: none; color: inherit; }

/* ── TOPNAV ── */
.topnav {
    background: linear-gradient(135deg, var(--bg-deep), var(--bg-dark));
    height: 56px; padding: 0 24px;
    display: flex; align-items: center; gap: 24px;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.nav-logo { font-size: 22px; font-weight: 900; color: white; letter-spacing: -1px; text-transform: lowercase; flex-shrink: 0; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 18px; transition: all 0.2s; }
.nav-links a:hover, .nav-links a.active { color: white; background: rgba(255,255,255,0.12); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-user { color: rgba(255,255,255,0.55); font-size: 12px; }
.nav-logout { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); padding: 6px 14px; border-radius: 16px; font-size: 12px; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.nav-logout:hover { background: rgba(233,69,96,0.25); border-color: rgba(233,69,96,0.4); color: #ff8fa3; }

/* ── PAGE LAYOUT ── */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ── CARDS ── */
.card { background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow-sm); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ── STAT CHIPS ── */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 20px; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--bg-dark); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 20px; border-radius: 20px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; letter-spacing: 0.3px; }
.btn-primary { background: linear-gradient(135deg, var(--bg-dark), var(--accent)); color: white; }
.btn-primary:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(233,69,96,0.3); }
.btn-secondary { background: var(--surface); border: 2px solid var(--border); color: var(--text-2); }
.btn-secondary:hover { border-color: var(--bg-mid); color: var(--text); }
.btn-danger { background: #fff0f3; border: 2px solid #ffd6e0; color: var(--accent-dk); }
.btn-danger:hover { background: #ffd6e0; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; justify-content: center; }

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--surface-2); padding: 10px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); font-weight: 700; border-bottom: 2px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); vertical-align: middle; }
.data-table tr:hover td { background: #f8f9ff; }
.data-table tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ── FORM ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; }
.form-input { padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--r-sm); font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit; color: var(--text); background: var(--surface); }
.form-input:focus { border-color: var(--bg-mid); box-shadow: 0 0 0 3px rgba(26,58,110,0.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.form-hint { font-size: 11px; color: var(--text-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: white; border-radius: var(--r-lg); padding: 28px; width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); transform: translateY(12px); transition: transform 0.25s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border: none; background: var(--surface-2); border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── SEARCH ── */
.search-bar { display: flex; gap: 10px; align-items: center; }
.search-input { padding: 9px 14px; border: 2px solid var(--border); border-radius: 20px; font-size: 13px; outline: none; transition: border-color 0.2s; width: 240px; font-family: inherit; }
.search-input:focus { border-color: var(--bg-mid); }

/* ── CONTRACT HIGHLIGHT ── */
.hl { background: #fffde6; border-radius: 2px; padding: 0 2px; transition: background 0.3s; }
.hl.flash { background: #ffd6e0; outline: 2px solid var(--accent); border-radius: 2px; }
.hl-empty { background: #f0f0f0; color: #bbb; }

/* ── ROLE PILLS ── */
.role-pill { display: inline-flex; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.role-superadmin { background: #f3e8ff; color: #6b21a8; }
.role-client_admin { background: #dbeafe; color: #1e40af; }
.role-client_user { background: #dcfce7; color: #15803d; }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
    .page-wrap { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .nav-user { display: none; }
    .search-input { width: 160px; }
}

/* ── PRINT ── */
@media print {
    .topnav, .sidebar, nav, .toolbar, .page-hint, .btn, button { display: none !important; }
    body { background: white; }
    .hl { background: none !important; outline: none !important; }
}
