/* O'lchamlar namunaviy skrinshotdan (telefon, ~372px kenglik) aniq o'lchab olingan. */
:root {
  --bg: #fdfdfd;
  --text: #333;
  --text-strong: #111;
  --muted: #777;
  --link: #337ab7;
  --link-dark: #23527c;
  --burger: #3d8ad2;
  --green: #5ca353;
  --green-hover: #518f49;
  --border: #ccc;
  --radius: 4px;
  --warn-bg: #fcf8e3; --warn-bd: #faebcc; --warn-tx: #8a6d3b;
  --danger-bg: #f2dede; --danger-bd: #ebccd1; --danger-tx: #a94442;
  --ok-bg: #dff0d8; --ok-bd: #d6e9c6; --ok-tx: #3c763d;
  --info-bg: #d9edf7; --info-bd: #bce8f1; --info-tx: #31708f;
  --pad-l: 32px;
  --pad-r: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, RobotoWeb, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42857143;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
a:hover, a:focus { color: var(--link-dark); }
[hidden] { display: none !important; }
p { margin: 0 0 10px; }

/* ---- Header: chapda logo, o'ngda 3 chiziqli menyu ---- */
.top {
  width: 100%;
  max-width: 440px;
  height: 59px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(var(--pad-r) - 1px) 0 calc(var(--pad-l) - 4px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1f5d96;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}
.brand img { display: block; width: 47px; height: 47px; }

/* Menyu tugmasi: yopiq holatda ko'k chiziqlar, ochiq holatda ko'k fonli tugma oq chiziqlar bilan */
.burger {
  width: 41px; height: 32px;
  margin-right: 0;
  padding: 0 9.5px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  transition: background-color .15s;
}
.burger span { display: block; height: 2px; border-radius: 1px; background: var(--burger); }
body.menu-open .burger { background: #048ce2; padding: 0 10.5px; }
body.menu-open .burger span { background: #fff; }

/* Ochilgan menyu: sarlavha ostida chiziq, havolalar o'rtada bir qatorda */
.menu {
  position: absolute;
  top: 59px;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 0 15px;
  background: var(--bg);
}
.menu-inner {
  max-width: 410px;
  margin: 0 auto;
  border-top: 1px solid #1a1a1a;
  padding: 7.5px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.menu a, .menu .linklike {
  display: block;
  padding: 10px 15px;
  color: var(--link);
  font: inherit;
  font-size: 15px;
  line-height: 20px;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.menu a:hover, .menu .linklike:hover { color: var(--link-dark); }
.menu form { margin: 0; }

/* ---- Bosh sahifa: hujjat kodi bo'yicha qidirish ---- */
.home { text-align: center; padding-top: 50px; }
.home .alert { text-align: left; }
.home-title { font-size: 34px; font-weight: 400; line-height: 1.15; color: #333; margin: 0 0 28px; }
.home-label { font-size: 18px; line-height: 1.4; color: #333; margin: 0 0 14px; }
.home-form input[type=text] { height: 46px; text-align: left; font-size: 16px; letter-spacing: .04em; }
.btn-info { background: #5bc0de; color: #fff; }
.btn-info:hover, .btn-info:focus { background: #46b8da; color: #fff; }
.btn-get {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 10px 26px;
  font-size: 19px;
  border-radius: 0;
}
.home-note { color: var(--muted); margin: 26px 0 0; }

/* ---- Asosiy ustun ---- */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 40px var(--pad-r) 40px var(--pad-l);
}
.wrap.wide, .top.wide { max-width: 900px; }

.h { font-size: 18px; font-weight: 500; line-height: 1.1; color: var(--text-strong); margin: 0 0 12px; }
.h2 { font-size: 16px; font-weight: 500; margin: 0 0 15px; color: var(--text-strong); }
.lead { color: var(--text-strong); margin: 0 0 23px; }
.meta { color: var(--muted); font-size: 13px; margin: 0 0 15px; word-break: break-word; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 15px !important; }

/* ---- Ogohlantirish bloklari (Bootstrap 3 o'lchamlari) ---- */
.alert {
  padding: 15px;
  margin: 0 0 17px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.alert::after { content: ""; display: table; clear: both; }
.alert a { color: var(--link-dark); text-decoration: underline; }
.alert .close {
  float: right;
  margin: 0 -3px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 21px;
  font-weight: 400;
  line-height: 1;
  color: inherit;
  opacity: .7;
  cursor: pointer;
}
.alert .close:hover { opacity: 1; }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-tx); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-tx); }
.alert-success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-tx); }
.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-tx); }

/* ---- Formalar ---- */
label, .label { display: block; margin: 0 0 6px; font-weight: 400; color: var(--text); }
input[type=text], input[type=password], input[type=date] {
  display: block;
  width: 100%;
  height: 44px;
  padding: 6px 12px;
  font: inherit;
  color: #555;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
input[type=password] { font-size: 18px; letter-spacing: .2em; }
input:focus { outline: 0; border-color: #66afe9; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6); }

.btn {
  display: inline-block;
  padding: 6px 12px;
  font: inherit;
  font-weight: 400;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover, .btn-success:focus { background: var(--green-hover); color: #fff; }
.btn-success:active { box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); }
.btn-default { background: #fff; color: #333; border-color: var(--border); }
.btn-default:hover { background: #e6e6e6; border-color: #adadad; color: #333; }
.btn-danger { background: #d9534f; color: #fff; }
.btn-danger:hover { background: #c9302c; color: #fff; }
.btn-danger-outline { background: #fff; color: #c9302c; border-color: #e6b8b7; }
.btn-danger-outline:hover { background: #fbeeee; }
.btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.5; }
.btn-block { display: block; width: 100%; height: 44px; margin-top: 25px; border: 0; }

.hint { color: var(--link); line-height: 1.15; margin: 24px 0 0; }

/* ---- Hujjatni ko'rish ---- */
.preview { display: block; width: 100%; height: 70vh; min-height: 380px; border: 1px solid #ddd; border-radius: var(--radius); background: #fff; }
.preview-img { display: block; max-width: 100%; margin: 0 auto; border: 1px solid #ddd; border-radius: var(--radius); background: #fff; }

/* ---- Boshqaruv paneli ---- */
.panel { background: #fff; border: 1px solid #ddd; border-radius: var(--radius); padding: 15px; margin: 0 0 20px; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; cursor: pointer; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick input:focus-visible + .btn { box-shadow: 0 0 0 3px rgba(102, 175, 233, .6); }
.file-name { color: var(--muted); word-break: break-all; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.radio { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; cursor: pointer; }
.radio input { width: 16px; height: 16px; margin: 0; }
#custom-pin { margin-top: 6px; }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; padding: 12px 0; border-top: 1px solid #eee; }
.doc-item:first-child { border-top: 0; padding-top: 0; }
.doc-main { flex: 1 1 280px; min-width: 0; }
.doc-title { font-size: 15px; font-weight: 500; text-decoration: none; word-break: break-word; }
.doc-main .meta { margin: 3px 0 0; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.confirm { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; background: var(--danger-bg); border: 1px solid var(--danger-bd); border-radius: var(--radius); color: var(--danger-tx); }
.confirm span { flex: 1 1 200px; }
.badge { display: inline-block; padding: 2px 7px; margin-left: 6px; font-size: 11px; font-weight: 700; border-radius: 10px; vertical-align: middle; }
.badge-danger { background: #d9534f; color: #fff; }
.badge-muted { background: #999; color: #fff; }

.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; height: 34px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.stats { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
.stats th, .stats td { text-align: left; padding: 6px 0; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.stats th { width: 42%; font-weight: 400; color: var(--muted); padding-right: 10px; }

/* ---- QR karta ---- */
.qr-card { background: #fff; border: 1px dashed #bbb; border-radius: 6px; padding: 20px; margin: 0 0 20px; text-align: center; }
.qr-brand { display: flex; align-items: center; justify-content: center; gap: 8px; color: #1f5d96; font-weight: 700; }
.qr-title { font-size: 18px; font-weight: 500; margin: 10px 0 15px; word-break: break-word; color: var(--text-strong); }
.qr-row { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.qr { width: 220px; height: 220px; image-rendering: pixelated; }
.qr-side { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.pin-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.pin-value { display: block; font-size: 34px; font-weight: 700; letter-spacing: .18em; font-family: "Roboto Mono", Consolas, monospace; color: var(--text-strong); }
.code-value { display: block; max-width: 250px; word-break: break-all; font-size: 14px; font-weight: 500; font-family: "Roboto Mono", Consolas, monospace; }
.qr-card .small { color: var(--muted); margin: 15px 0 0; }

.foot { text-align: center; color: #b5b5b5; font-size: 12px; padding: 15px 16px 22px; }

@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .preview { height: 62vh; }
}

@media print {
  body { background: #fff; }
  .top, .menu, .foot, .no-print, .alert { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .qr-card { border: 1px dashed #888; max-width: 520px; margin: 0 auto; }
}
