/* Portal técnico Infopiri — cinza claro neutro */
:root {
  --bg: #f4f5f7;
  --bg-soft: #eef0f3;
  --card: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #374151;
  --accent-soft: #4b5563;
  --brand: #111827;
  --link: #2563eb;
  --ok: #059669;
  --warn: #d97706;
  --err: #dc2626;
  --header-h: 64px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* ── Login (mantém visual Infopiri escuro) ── */
#view-login {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #04070f 0%, #071227 38%, #0e2a4d 72%, #16466f 100%);
  font-family: Archivo, Helvetica, Arial, sans-serif;
}
.login-skyline {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2.2vw;
  padding: 0 4vw;
  opacity: 0.9;
  pointer-events: none;
}
.login-bldg {
  border: 1px solid rgba(140, 190, 235, 0.16);
  border-bottom: none;
  background-image: repeating-linear-gradient(
      90deg,
      rgba(150, 200, 240, 0.26) 0 1px,
      transparent 1px 22px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(150, 200, 240, 0.2) 0 1px,
      transparent 1px 26px
    );
}
.login-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 24px;
}
.login-card {
  width: 100%;
  max-width: 520px;
  background: rgba(8, 18, 34, 0.78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(160, 205, 245, 0.2);
  border-radius: 4px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  padding: 56px 48px 40px;
}
.login-card img.logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 100%;
  margin-bottom: 40px;
}
.login-card h1 {
  margin: 0 0 22px;
  font-size: 40px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f2f7fc;
}
.login-card .kicker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 34px;
  padding-left: 14px;
  border-left: 1px solid rgba(160, 205, 245, 0.28);
  font-size: 17px;
  color: #c9dcee;
  font-weight: 500;
}
.login-card .desc {
  margin: 0 0 38px;
  font-size: 15px;
  line-height: 1.6;
  color: #93a9c1;
}
.login-card label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8eabc6;
  font-family: "IBM Plex Mono", monospace;
}
.login-card input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: rgba(4, 12, 24, 0.72);
  border: 1px solid rgba(160, 205, 245, 0.22);
  border-radius: 3px;
  color: #f2f7fc;
  font-size: 16px;
  font-family: Archivo, Helvetica, Arial, sans-serif;
  outline: none;
}
.login-card input:focus {
  border-color: rgba(90, 160, 220, 0.65);
  box-shadow: 0 0 0 3px rgba(47, 127, 208, 0.18);
}
.login-card .form-gap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-card button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  margin-top: 8px;
  background: #2f7fd0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.login-card button[type="submit"]:hover {
  background: #3a92e8;
}
.login-card .login-error {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}
.login-foot {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64798f;
}
.login-foot a {
  color: #7fb4e6;
}

/* ── App shell ── */
#view-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
}
.brand-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.brand-left .product {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.brand-left .sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  flex: 1;
}
.app-nav a {
  color: var(--accent);
  background: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  text-decoration: none;
  white-space: nowrap;
}
.app-nav a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.app-nav a.active {
  background: var(--bg-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(55, 65, 81, 0.12);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header-right .user-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}
.header-right .user-meta strong {
  color: var(--brand);
  display: block;
}
.header-right .infopiri-logo {
  height: 32px;
  width: auto;
  display: block;
}
.btn-logout {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-logout:hover {
  background: #b91c1c;
}
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 6px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--brand);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover {
  background: var(--bg-soft);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-soft);
}
.btn-danger {
  background: #fef2f2;
  color: var(--err);
  border-color: #fecaca;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 560px;
}
table.data th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
table.data tr:last-child td {
  border-bottom: none;
}
table.data tr:hover td {
  background: #fafafa;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid .full {
  grid-column: 1 / -1;
}
.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field textarea {
  min-height: 80px;
  resize: vertical;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-soft);
  color: var(--accent);
}
.badge-ok {
  background: #ecfdf5;
  color: var(--ok);
}
.badge-warn {
  background: #fffbeb;
  color: var(--warn);
}

/* Storage */
.storage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.storage-stat {
  flex: 1;
  min-width: 160px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.storage-stat .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.storage-stat .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
}
.progress {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.progress.warn > span {
  background: var(--warn);
}
.progress.danger > span {
  background: var(--err);
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  word-break: break-all;
}
.breadcrumb a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.storage-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.storage-name.is-dir {
  cursor: pointer;
  color: var(--brand);
}
.storage-name.is-dir:hover {
  text-decoration: underline;
}
.msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.msg.ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.msg.err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Calendário simples */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-head {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px;
  text-transform: uppercase;
}
.cal-cell {
  min-height: 72px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
}
.cal-cell.muted {
  opacity: 0.45;
  background: var(--bg-soft);
}
.cal-cell .day {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--brand);
}
.cal-event {
  display: block;
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 2px 4px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .app-nav {
    display: none;
  }
  body.nav-open .app-nav {
    display: flex;
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(var(--header-h) + 4px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 50;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .header-right .user-meta {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 40px 24px 28px;
  }
  .login-card h1 {
    font-size: 32px;
  }
  .cal-cell {
    min-height: 54px;
  }
}

/* Admin */
.app-nav a.nav-admin {
  border-color: #9ca3af;
  font-weight: 700;
}
.admin-app-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}
.admin-app-tab {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}
.admin-app-tab:hover {
  background: var(--bg-soft);
}
.admin-app-tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow);
}
.stat-card .stat-n {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
}
.stat-card .stat-l {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.admin-create {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.admin-create input,
.admin-create select {
  flex: 1 1 140px;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
.admin-clients td {
  vertical-align: top;
}
.admin-clients tr.row-blocked {
  background: rgba(185, 28, 28, 0.04);
}
.admin-actions-cell {
  min-width: 220px;
}
.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.admin-expires-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.admin-expires-row .admin-expires {
  width: auto;
  min-width: 140px;
  max-width: 160px;
}
.admin-actions {
  white-space: nowrap;
}
.admin-actions .btn {
  margin: 2px 0;
}
.admin-plan,
.admin-expires,
.admin-quota {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  max-width: 100%;
}
.admin-plan {
  min-width: 110px;
}
.admin-expires {
  width: 100%;
  min-width: 140px;
}
.admin-quota {
  width: 88px;
  margin-left: 4px;
}
.admin-expires-actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.admin-email-link {
  font-weight: 600;
  color: var(--link);
}
.admin-email-link:hover {
  text-decoration: underline;
}
.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.admin-detail-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.admin-detail-form label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-resets {
  list-style: none;
  margin-top: 8px;
}
.admin-resets li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 700;
}
.page-head p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.admin-deleted-card h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}
span.muted {
  color: var(--text-muted);
  font-size: 12px;
}
