:root {
  --bg: #070a12;
  --panel: rgba(255, 255, 255, 0.04);
  --panel2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.55);
  --accent: rgba(120, 180, 255, 0.90);
  --good: rgba(80, 220, 140, 0.85);
  --warn: rgba(255, 200, 90, 0.90);
  --bad: rgba(255, 90, 110, 0.90);
  --shadow: 0 20px 70px rgba(0,0,0,0.55);
  --radius: 18px;
}

/* IMPORTANT: make native controls (select dropdown) dark */
html { height: 100%; color-scheme: dark; }
body { height: 100%; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background: radial-gradient(900px 700px at 70% 30%, rgba(150, 90, 255, 0.18), transparent 55%),
              radial-gradient(900px 700px at 15% 35%, rgba(90, 160, 255, 0.16), transparent 55%),
              radial-gradient(900px 700px at 50% 95%, rgba(90, 255, 200, 0.08), transparent 60%),
              var(--bg);
}

a { color: inherit; text-decoration: none; }

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(5, 7, 12, 0.60);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 18px;
  padding: 8px 10px;
  border-radius: 12px;
  transition: background 120ms ease;
  flex: 0 0 auto;
}

.brand:hover { background: rgba(255,255,255,0.06); }

/* SEARCHBAR: теперь не сужается из-за кнопки Ieșire */
.searchbar {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: none;
  margin: 0;
  min-width: 280px;
}

.searchbar input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

.searchbar input::placeholder { color: rgba(255,255,255,0.35); }

.btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
}

.btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.btn.primary {
  background: rgba(90, 160, 255, 0.18);
  border-color: rgba(120, 180, 255, 0.35);
}

.btn.danger {
  background: rgba(255, 90, 110, 0.12);
  border-color: rgba(255, 90, 110, 0.30);
  color: rgba(255,190,200,0.95);
}

.btn.danger:hover {
  background: rgba(255, 90, 110, 0.18);
  border-color: rgba(255, 90, 110, 0.38);
}

/* CONTAINER: теперь почти на весь экран, а не маленький */
.container {
  padding: 18px;
  width: 100%;
  max-width: 96vw;
  margin: 0 auto;
}

.panel {
  width: 100%;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-title {
  font-weight: 800;
  font-size: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.60);
  flex-wrap: wrap;
}

.breadcrumb a { color: rgba(255,255,255,0.70); }
.breadcrumb a:hover { color: rgba(120,180,255,0.95); }
.breadcrumb .sep { opacity: 0.25; }

.section-title {
  margin-top: 12px;
  margin-bottom: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.78);
}

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

/* SORT SELECT */
.select {
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.92);
  padding: 0 14px;
  outline: none;
  cursor: pointer;
  min-width: 170px;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.65) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.65) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 12px) 16px,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.select:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
}

.select option {
  background: rgba(10, 14, 22, 0.98);
  color: rgba(255,255,255,0.92);
}

/* GRID: теперь адаптивный, на широком экране будет больше колонок */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.22);
  padding: 12px;
  transition: transform 120ms ease, border 120ms ease, background 120ms ease;
  position: relative;
  overflow: visible;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.file-icon, .dir-icon {
  height: 26px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.85);
}

.badge {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.80);
}

.badge.good {
  border-color: rgba(80,220,140,0.30);
  background: rgba(80,220,140,0.10);
  color: rgba(170,255,210,0.95);
}

.badge.warn {
  border-color: rgba(255,200,90,0.35);
  background: rgba(255,200,90,0.10);
  color: rgba(255,230,180,0.95);
}

.badge.error {
  border-color: rgba(255,90,110,0.35);
  background: rgba(255,90,110,0.10);
  color: rgba(255,190,200,0.95);
}

.kebab {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  position: relative;
  z-index: 6;
}

.kebab:hover { background: rgba(255,255,255,0.07); }

/* title FIX: чтобы имя не раздражало и не выглядело криво */
.title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  color: rgba(255,255,255,0.94);
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;

  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.meta {
  margin-top: 6px;
  color: rgba(255,255,255,0.45);
  font-size: 12px;
}

.card a.stretch {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 3;
  position: relative;

  overflow: visible;
  flex: 0 0 auto;
}

/* DROPDOWN FIX: больше не мигает */
.dropdown {
  position: absolute;
  right: 0;
  top: 38px;
  min-width: 180px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10, 14, 22, 0.96);
  box-shadow: 0 30px 110px rgba(0,0,0,0.75);
  padding: 6px;
  z-index: 60;

  /* вместо display:none */
  display: block;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  transform-origin: top right;
}

.dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.dd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  font-size: 13px;
}

.dd-item:hover { background: rgba(255,255,255,0.07); }

.dd-item.danger { color: rgba(255,130,150,0.95); }
.dd-item.danger:hover { background: rgba(255,90,110,0.12); }

hr.sep {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 12px 0;
}

/* HINT / ERROR */
.hint {
  margin-top: 10px;
  color: rgba(255,255,255,0.50);
  font-size: 12px;
  line-height: 1.4;
}

.error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,90,110,0.25);
  background: rgba(255,90,110,0.08);
  color: rgba(255,190,200,0.95);
  font-size: 13px;
}

/* TEXT EDITOR */
.text-editor {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  padding: 14px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.text-editor.big {
  min-height: 560px;
}

.text-editor:focus {
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.10);
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.open {
  display: flex;
}

.modal-box {
  width: 420px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  border-radius: 16px;
  background: rgba(10, 14, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color: #fff;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255,255,255,0.07);
}

.modal-box input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  outline: none;
}

.modal-box input[type="text"]:focus {
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.10);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* AUTH (LOGIN) */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 420px;
  max-width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-brand {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.auth-sub {
  margin-top: 4px;
  color: rgba(255,255,255,0.60);
  font-size: 13px;
}

.auth-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}

.auth-input {
  width: 100%;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  padding: 0 12px;
  outline: none;
}

.auth-input::placeholder {
  color: rgba(255,255,255,0.35);
}

.auth-input:focus {
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.10);
}

.auth-btn {
  width: 100%;
  margin-top: 10px;
}

/* clickable filename must be above the stretch link */
.file-name {
  position: relative;
  z-index: 3;
  display: inline-block;
}

.file-name:hover {
  color: rgba(120,180,255,0.95);
  text-decoration: underline;
}

/* viewer */
.viewer-box {
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  overflow: hidden;
}

.viewer-frame {
  width: 100%;
  height: 78vh;
  border: 0;
  display: block;
}

.viewer-img {
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  padding: 10px;
}

/* DOCX PREVIEW FIX (чтобы не было белого экрана) */
.docx-preview {
  padding: 14px;
  height: 78vh;
  overflow: auto;
  background: rgba(0,0,0,0.16);
}

.docx-pre {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.viewer-fallback {
  padding: 12px 14px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
}
