/* ==========================================================
   Ä°ris HR UI v9
   Full Responsive SaaS Layout
   Mobile + Desktop Safe
   ========================================================== */

:root {
  --bg: #070b16;
  --bg-soft: #0b1020;
  --sidebar: rgba(10, 16, 31, .94);
  --card: rgba(15, 23, 42, .78);
  --card-strong: rgba(15, 23, 42, .92);
  --card-light: rgba(255, 255, 255, .075);
  --text: #f8fbff;
  --muted: #9aa7bd;
  --line: rgba(255,255,255,.12);
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --green: #22c55e;
  --red: #ff5574;
  --yellow: #fbbf24;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 24px 80px rgba(0,0,0,.38);
  --sidebar-width: 286px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(124,92,255,.30), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(0,212,255,.20), transparent 30%),
    linear-gradient(135deg, #070b16, #0b1020 55%, #09111f);
  overflow-x: hidden;
}

a {
  color: inherit;
}

img, video, canvas, svg {
  max-width: 100%;
}

.glass {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

/* ==========================================================
   Layout
   ========================================================== */

.layout {
  min-height: 100dvh;
  display: flex;
  width: 100%;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  min-width: 0;
  height: 100dvh;
  position: sticky;
  top: 0;
  padding: 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 70px rgba(0,0,0,.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.content {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-x: hidden;
}

/* ==========================================================
   Mobile Sidebar
   ========================================================== */

.mobile-menu-btn {
  display: none;
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 1002;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  font-size: 22px;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(4px);
}

/* ==========================================================
   Sidebar
   ========================================================== */

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand-badge {
  width: 66px;
  height: 66px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 38px;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(124,92,255,.34);
}

.brand-badge.small {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 25px;
}

.side-brand b {
  display: block;
  font-size: 18px;
  letter-spacing: -.02em;
}

.side-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.side-user {
  margin: 14px 0;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  flex: 0 0 auto;
}

.side-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(34,197,94,.9), rgba(0,212,255,.85));
  font-weight: 900;
}

.side-user b {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user span {
  color: var(--muted);
  font-size: 12px;
}

.iris-nav,
.sidebar nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-right: 4px;
}

.iris-nav::-webkit-scrollbar,
.sidebar nav::-webkit-scrollbar {
  width: 6px;
}

.iris-nav::-webkit-scrollbar-thumb,
.sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.16);
  border-radius: 999px;
}

.iris-nav a,
.sidebar nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
  padding: 11px 12px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
  transition: .18s ease;
  white-space: nowrap;
}

.iris-nav a:hover,
.sidebar nav a:hover {
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.08);
  transform: translateX(2px);
}

.iris-nav a.active,
.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(124,92,255,.36), rgba(0,212,255,.16));
  border-color: rgba(124,92,255,.45);
}

.nav-ico {
  width: 24px;
  flex: 0 0 24px;
  text-align: center;
}

.logout-link {
  color: #fecdd3 !important;
}

/* ==========================================================
   Header
   ========================================================== */

.topbar {
  width: 100%;
  min-width: 0;
  min-height: 88px;
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  margin: 0 0 6px;
  letter-spacing: -.04em;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.role-pill {
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(34,197,94,.14);
  border: 1px solid rgba(34,197,94,.28);
  color: #b7ffd9;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}

/* ==========================================================
   Cards & Grids
   ========================================================== */

.hero-grid,
.cards-grid,
.module-grid,
.identity-grid,
.stats-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.cards-grid,
.module-grid,
.identity-grid,
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
}

.panel,
.clock-card,
.virtual-id,
.module-card,
.auth-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 22px;
}

.panel h2,
.clock-card h2,
.module-card h2 {
  margin-top: 0;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .18s ease, border-color .18s ease;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124,92,255,.42);
}

.module-card::before {
  content: "";
  position: absolute;
  right: -46px;
  top: -46px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(124,92,255,.20);
  pointer-events: none;
}

.module-card span {
  color: var(--muted);
  font-size: 13px;
}

.module-card b {
  display: block;
  font-size: clamp(23px, 4vw, 34px);
  line-height: 1.05;
  margin: 4px 0;
}

.module-card small {
  color: #b7ffd9;
  font-weight: 800;
}

.module-card p {
  color: var(--muted);
  margin: 0;
}

.module-card code {
  display: block;
  max-width: 100%;
  word-break: break-all;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  padding: 10px;
  border-radius: 12px;
  color: #dbeafe;
}

.item-row {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.item-row:first-of-type {
  border-top: 0;
}

.item-row > div {
  min-width: 0;
}

.item-row b,
.item-row span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.item-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.item-row small {
  color: #b7ffd9;
  font-weight: 800;
  text-align: right;
  flex: 0 0 auto;
}

/* ==========================================================
   Forms
   ========================================================== */

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: rgba(255,255,255,.07);
  color: var(--text);
  outline: none;
  font: inherit;
}

select option {
  background: #111827;
  color: white;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
}

.btn,
button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  color: white;
  font-weight: 850;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.danger {
  background: linear-gradient(135deg, var(--red), #ff8a4c);
}

.alert {
  padding: 14px 16px;
  border-radius: 18px;
}

.alert.error {
  background: rgba(255,85,116,.15);
  border: 1px solid rgba(255,85,116,.35);
}

/* ==========================================================
   Dashboard
   ========================================================== */

.big-action {
  width: 100%;
  min-height: 74px;
  font-size: 21px;
  border-radius: 24px;
  margin-top: 18px;
}

.schedule-box {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  display: grid;
  gap: 5px;
}

.schedule-box span,
.schedule-box small {
  color: var(--muted);
}

.virtual-id {
  position: relative;
  background:
    linear-gradient(135deg, rgba(124,92,255,.28), rgba(0,212,255,.16)),
    var(--card);
}

.virtual-id::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  right: -80px;
  bottom: -120px;
  background: rgba(255,255,255,.08);
}

.id-top,
.id-bottom {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.id-top span,
.id-bottom span {
  color: var(--muted);
  font-size: 12px;
}

.qr {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, #fff 25%, transparent 25%),
    linear-gradient(#fff 25%, transparent 25%),
    #111827;
  background-size: 12px 12px;
  color: transparent;
}

.id-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 34px 0;
  min-width: 0;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--line);
  font-size: 32px;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================
   Identity / Signature
   ========================================================== */

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.signature-block {
  margin-top: 28px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 14px;
  background: #f9fafb;
  color: #111827;
  display: grid;
  gap: 6px;
}

.signature-block code {
  word-break: break-all;
}

/* ==========================================================
   Auth
   ========================================================== */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 20px;
}

.auth-shell {
  width: min(460px, 100%);
}

.auth-card {
  padding: 34px;
}

/* ==========================================================
   Mobile
   ========================================================== */

@media (max-width: 900px) {
  .layout {
    display: block;
    min-height: 100dvh;
    padding-top: 72px;
  }

  .content {
    padding: 12px;
    gap: 12px;
  }

  .mobile-menu-btn {
    display: grid;
    place-items: center;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(326px, 86vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .24s ease;
    z-index: 1000;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .topbar {
    min-height: auto;
    padding: 18px;
    border-radius: var(--radius-lg);
    align-items: flex-start;
  }

  .panel,
  .clock-card,
  .virtual-id,
  .module-card,
  .auth-card {
    border-radius: var(--radius-lg);
    padding: 18px;
  }

  .hero-grid,
  .cards-grid,
  .module-grid,
  .identity-grid,
  .stats-grid {
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .item-row {
    flex-direction: column;
    gap: 8px;
  }

  .item-row small {
    text-align: left;
  }

  .id-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .big-action {
    min-height: 64px;
    font-size: 18px;
  }
}

@media (max-width: 420px) {
  .content {
    padding: 10px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .brand-badge {
    width: 58px;
    height: 58px;
    border-radius: 20px;
    font-size: 34px;
  }

  .btn,
  button {
    width: 100%;
  }

  .card-actions .btn,
  .card-actions button {
    width: auto;
    flex: 1 1 auto;
  }
}

/* Enhanced Digital Identity */
.enhanced-id { overflow:hidden; }
.enhanced-id .id-chip-row { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.enhanced-id .id-chip-row span { background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.22); padding:6px 10px; border-radius:999px; font-size:12px; font-weight:800; letter-spacing:.04em; }
.enhanced-id .id-meta-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:14px 0; }
.enhanced-id .id-meta-grid div { background:rgba(15,23,42,.24); border:1px solid rgba(255,255,255,.12); border-radius:14px; padding:10px; }
.enhanced-id .id-meta-grid small { display:block; opacity:.72; font-size:11px; margin-bottom:4px; }
.enhanced-id .id-meta-grid b { display:block; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:640px){ .enhanced-id .id-meta-grid{grid-template-columns:1fr;} }