:root {
  --bg: #eef3f5;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --text: #101a24;
  --muted: #667687;
  --line: #d8e1e7;
  --brand: #0b6f68;
  --brand-dark: #064a46;
  --nav: #101923;
  --nav-soft: #1c2b39;
  --accent: #d99a2b;
  --blue: #255f85;
  --danger: #b42318;
  --success: #087443;
  --shadow: 0 18px 46px rgba(16, 25, 35, 0.11);
  --soft-shadow: 0 8px 22px rgba(16, 25, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f7fafb 0%, #eef3f5 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background:
    linear-gradient(125deg, rgba(16, 25, 35, 0.94), rgba(6, 74, 70, 0.9)),
    url("calferquim-logo.png") calc(100% - 70px) calc(100% - 60px) / 260px no-repeat,
    #101923;
}

.login-card {
  width: min(440px, 100%);
  margin: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.3);
  padding: 34px;
  display: grid;
  gap: 16px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-logo {
  width: 94px;
  height: 94px;
  object-fit: contain;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--soft-shadow);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 800;
}

.topbar {
  min-height: 104px;
  padding: 18px 30px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(216, 225, 231, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  display: block;
  padding: 7px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 29px;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  margin-bottom: 14px;
}

h3 {
  font-size: 16px;
}

.topbar-actions,
.form-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

button,
.import-label,
.button {
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #ffffff;
  min-height: 42px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(11, 111, 104, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover,
.import-label:hover,
.button:hover {
  background: var(--brand-dark);
  box-shadow: 0 12px 24px rgba(11, 111, 104, 0.24);
  transform: translateY(-1px);
}

.ghost {
  background: #eef5f5;
  color: var(--brand-dark);
  box-shadow: none;
}

.ghost:hover {
  background: #dceaea;
  box-shadow: none;
}

.danger {
  background: #fff1ef;
  color: var(--danger);
  box-shadow: none;
}

.danger:hover {
  background: #ffe0dc;
  box-shadow: none;
}

.user-pill {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 999px;
  color: #314355;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
}

.import-label input {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 104px);
}

.sidebar {
  padding: 22px 16px;
  background:
    linear-gradient(180deg, #101923 0%, #132233 100%);
  border-right: 1px solid #213242;
}

.sidebar-title {
  color: #9eb5c8;
  font-size: 12px;
  font-weight: 900;
  margin: 5px 13px 16px;
  text-transform: uppercase;
}

.nav {
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
  background: transparent;
  color: #dce7ef;
  box-shadow: none;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  justify-content: flex-start;
}

.nav.active,
.nav:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.09);
  border-left-color: var(--accent);
  color: #ffffff;
  box-shadow: none;
}

.content {
  padding: 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view.active::before {
  content: "";
  display: block;
  height: 120px;
  margin: -28px -28px -92px;
  background: linear-gradient(90deg, rgba(11, 111, 104, 0.14), rgba(217, 154, 43, 0.13), rgba(37, 95, 133, 0.12));
  border-bottom: 1px solid rgba(216, 225, 231, 0.75);
}

.stats-grid,
.toolbar,
.split,
.panel,
.lifesheet {
  position: relative;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat,
.panel,
.lifesheet {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(216, 225, 231, 0.92);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.stat {
  min-height: 126px;
  padding: 20px;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: rgba(11, 111, 104, 0.1);
  transform: rotate(14deg);
}

.stat:nth-child(2)::after {
  background: rgba(8, 116, 67, 0.1);
}

.stat:nth-child(3)::after {
  background: rgba(217, 154, 43, 0.14);
}

.stat:nth-child(4)::after {
  background: rgba(37, 95, 133, 0.12);
}

.stat span {
  color: var(--muted);
  font-weight: 800;
}

.stat strong {
  display: block;
  font-size: 38px;
  margin-top: 14px;
  color: var(--nav);
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.toolbar {
  margin-bottom: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(216, 225, 231, 0.9);
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
}

.toolbar input,
.toolbar select {
  min-height: 44px;
}

.toolbar input {
  flex: 1;
  min-width: 240px;
}

.split {
  display: grid;
  grid-template-columns: minmax(330px, 410px) 1fr;
  gap: 20px;
  align-items: start;
}

.form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #344456;
  font-size: 13px;
  font-weight: 850;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #ffffff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 4px solid rgba(11, 111, 104, 0.13);
  border-color: var(--brand);
}

textarea {
  resize: vertical;
}

.asset-list,
.list {
  display: grid;
  gap: 12px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.item:hover {
  border-color: rgba(11, 111, 104, 0.32);
  box-shadow: var(--soft-shadow);
  transform: translateY(-1px);
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.item-photo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.item-title {
  font-weight: 900;
  color: #142333;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #e8f5f1;
  color: var(--success);
  white-space: nowrap;
}

.badge.warn {
  background: #fff4db;
  color: #875100;
}

.badge.off {
  background: #fff0ee;
  color: var(--danger);
}

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

.item-actions button {
  min-height: 34px;
  padding: 7px 11px;
}

.lifesheet {
  padding: 26px;
}

.image-preview {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface-soft);
}

.image-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

.lifesheet-photo {
  width: min(320px, 100%);
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: var(--surface-soft);
  margin-bottom: 16px;
}

.lifesheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.field {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
  border: 1px dashed #c8d4dc;
  border-radius: 14px;
  background: var(--surface-soft);
}

@media (max-width: 980px) {
  .layout,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px;
  }

  .sidebar-title {
    min-width: max-content;
    align-self: center;
    margin: 0 6px;
  }

  .nav {
    min-width: 160px;
    margin-bottom: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .brand-block {
    align-items: center;
  }

  .brand-logo {
    width: 62px;
    height: 62px;
  }

  h1 {
    font-size: 22px;
  }

  .content {
    padding: 14px;
  }

  .view.active::before {
    margin: -14px -14px -92px;
  }

  .stats-grid,
  .lifesheet-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .sidebar,
  .toolbar,
  .nav,
  button {
    display: none !important;
  }

  .layout,
  .content,
  .view.active {
    display: block;
    padding: 0;
  }

  .view.active::before,
  .view:not(#lifesheet) {
    display: none !important;
  }

  .lifesheet {
    border: 0;
    box-shadow: none;
  }
}
